Can anybody please help? I'm trying to get select options to work in series, so that the value of the first selection runs a query that puts results in the second option box, then that selection in turn repeats the same for the next, and so on and so on. I can only make one work! here's the code:
echo '<br>Select Subject: <br />
<form action="user_interfaceX.php" method="post">
<li><b>Subject areas:<select name="subject">
<option value="option1">Please Select</option>';
// Display the Subjects
$query_result1 = mysql_query ('SELECT * FROM subject ORDER BY subject_id');
while ($row = mysql_fetch_array ($query_result1, MYSQL_NUM)) {
echo "<option value=\"$row[0]\">$row[1]</option>\n";
}
echo '</select></b><br><br>Select Module:<b><br>
<br><li>Subject areas: <select name="module">
<option value="option1">Please Select</option>';
// Display the Modules
$query_result2 = mysql_query ("SELECT subject_id,module_code FROM module WHERE subject_id = {$HTTP_POST_VARS['subject']} ORDER BY subject_id");
while ($row2 = mysql_fetch_array ($query_result2, MYSQL_NUM)) {
echo "<option value=\"$row2[0]\">$row2[1]</option>\n";
}