0

hi guys, I would greatly appreciate it if you could help me with this code

I have some tables called,

Student (SID,SNAME) -> I have got data into it
Course(CID,CNAME) -> I have got data into it
Take(SID,CID) -> I have got data into it
quesion (CID,QNO,MRKS)-> I have got data into it
answer (SID,CID,QNO,ACTUALMRKS) ->I need to insert data into it?

Now I want to display CID as drop-down menu from Take table

if I select a data from above the drop-down menu then another drop-down menu should create automatically with the SID form Take who is taking particular CID.

If I selected both field then QNO (should come from the question table) and a extra text field (depend on how many QNO has itself) has to create automatically to enter ACTUALMRKS.

if I submit then all data has to store into the answer table

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by mtvaran
0

You want help with the code, yet you haven't posted any. Making tables is fine, but you need to show us the php you have so far.

0

You want help with the code, yet you haven't posted any. Making tables is fine, but you need to show us the php you have so far.

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }


  mysql_select_db("uni", $con)or trigger_error('MySQL error: ' . mysql_error());
$result  = mysql_query("SELECT DISTINCT CourseID FROM examquesion") or trigger_error('MySQL error: ' . mysql_error());


echo '<select name="cid">';

while($row = mysql_fetch_array($result))
{

    echo '<option value="' . $row['CourseID'] . '">'  . $row['CourseID'] . ' </option>';
}

echo '</select>';

// ----------------

?>
  </div>
  <p>&nbsp;</p>
  <form id="form1" name="form1" method="post" action="result.php">
    <label>
      <input type="submit" name="Submit" value="Submit" />
    </label>
  </form>

result.php

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("uni", $con)or trigger_error('MySQL error: ' . mysql_error());
$result  = mysql_query("SELECT DISTINCT StudentID FROM take") or trigger_error('MySQL error: ' . mysql_error());


echo '<select name="sid">';

while($row = mysql_fetch_array($result))
{

    echo '<option value="' . $row['StudentID'] . '">'  . $row['StudentID'] . ' </option>';
}

echo '</select>';

// ----------------
echo "<br><br>";

 mysql_select_db("uni", $con)or trigger_error('MySQL error: ' . mysql_error());
$result  = mysql_query("SELECT DISTINCT QuesionNo,MarksAllocated FROM examquesion ORDER BY QuesionNo ASC") or trigger_error('MySQL error: ' . mysql_error());

echo "<table width=200 border=1>";
echo "<tr><th>QuesionNo</th><th>MarksAllocated</th><th>ActualMarks</th></tr>";


while($row = mysql_fetch_array ($result))
{
echo "<tr><td>";
echo $row['QuesionNo'];
echo "</td><td>";
echo $row['MarksAllocated'];
echo "</td><td>";
echo $row['ActualMarks'];
echo "</td></tr>";
}

?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.