Hi
I have 3 drop down lists depending on what you select in the first drop down, will determine what drop down is displayed, ie when option from dropdown 1 is selected dropdown 2 or 3 will be displayed depending on what option was selected in dropdown 1. Do I need javascript or caqn it be done without. Really coming near to my deadlone and can't figure this out. Also if this helps the dropdowns are pulling from a mysql database.
Tks in advance
------------Dropdown 1---------------
echo'<table align="center">';
if(isset($_POST['secondary_exam_id']))
$_SESSION['secondary_exam_id']=$_POST['secondary_exam_id'];
echo'<tr>
<td colspan="2" class="labelcell">
<label for="secondary_exam_id">* Select Curriculum:</label></td>';
echo'<td colspan="2" class="fieldcell2">
<select name="secondary_exam_id">';
$query_result = mysql_query ('SELECT * FROM secondary_exam_type ORDER BY secondary_exam_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
if($row[0] == $_SESSION['secondary_exam_id'])
{
$checked = 'selected';
}
else
{
$checked = NULL;
}
echo "<option value=\"$row[0]\" $checked>$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
------------Dropdown 2---------------
if(isset($_POST['junior_subject_id']))
$_SESSION['junior_subject_id']=$_POST['junior_subject_id'];
echo'<tr>
<td colspan="2" class="labelcell">
<label for="junior_subject_id">* Select Junior Subject:</label></td>';
echo'<td colspan="2" class="fieldcell2">
<select name="junior_subject_id">';
$query_result = mysql_query ('SELECT * FROM junior_subjects ORDER BY junior_subject_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
if($row[0] == $_SESSION['junior_subject_id'])
{
$checked = 'selected';
}
else
{
$checked = NULL;
}
echo "<option value=\"$row[0]\" $checked>$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
------------Dropdown 3---------------
if(isset($_POST['leaving_subject_id']))
$_SESSION['leaving_subject_id']=$_POST['leaving_subject_id'];
echo'<tr>
<td colspan="2" class="labelcell">
<label for="leaving_subject_id">* Select leaving Subject:</label></td>';
echo'<td colspan="2" class="fieldcell2">
<select name="leaving_subject_id">';
$query_result = mysql_query ('SELECT * FROM leaving_subjects ORDER BY leaving_subject_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
if($row[0] == $_SESSION['leaving_subject_id'])
{
$checked = 'selected';
}
else
{
$checked = NULL;
}
echo "<option value=\"$row[0]\" $checked>$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
I have 3 drop down lists depending on what you select in the first drop down, will determine what drop down is displayed, ie when option from dropdown 1 is selected dropdown 2 or 3 will be displayed depending on what option was selected in dropdown 1. Do I need javascript or caqn it be done without. Really coming near to my deadlone and can't figure this out. Also if this helps the dropdowns are pulling from a mysql database.
Tks in advance
------------Dropdown 1---------------
echo'<table align="center">';
if(isset($_POST['secondary_exam_id']))
$_SESSION['secondary_exam_id']=$_POST['secondary_exam_id'];
echo'<tr>
<td colspan="2" class="labelcell">
<label for="secondary_exam_id">* Select Curriculum:</label></td>';
echo'<td colspan="2" class="fieldcell2">
<select name="secondary_exam_id">';
$query_result = mysql_query ('SELECT * FROM secondary_exam_type ORDER BY secondary_exam_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
if($row[0] == $_SESSION['secondary_exam_id'])
{
$checked = 'selected';
}
else
{
$checked = NULL;
}
echo "<option value=\"$row[0]\" $checked>$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
------------Dropdown 2---------------
if(isset($_POST['junior_subject_id']))
$_SESSION['junior_subject_id']=$_POST['junior_subject_id'];
echo'<tr>
<td colspan="2" class="labelcell">
<label for="junior_subject_id">* Select Junior Subject:</label></td>';
echo'<td colspan="2" class="fieldcell2">
<select name="junior_subject_id">';
$query_result = mysql_query ('SELECT * FROM junior_subjects ORDER BY junior_subject_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
if($row[0] == $_SESSION['junior_subject_id'])
{
$checked = 'selected';
}
else
{
$checked = NULL;
}
echo "<option value=\"$row[0]\" $checked>$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';
------------Dropdown 3---------------
if(isset($_POST['leaving_subject_id']))
$_SESSION['leaving_subject_id']=$_POST['leaving_subject_id'];
echo'<tr>
<td colspan="2" class="labelcell">
<label for="leaving_subject_id">* Select leaving Subject:</label></td>';
echo'<td colspan="2" class="fieldcell2">
<select name="leaving_subject_id">';
$query_result = mysql_query ('SELECT * FROM leaving_subjects ORDER BY leaving_subject_id');
while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))
{
if($row[0] == $_SESSION['leaving_subject_id'])
{
$checked = 'selected';
}
else
{
$checked = NULL;
}
echo "<option value=\"$row[0]\" $checked>$row[1]</option>\n";
}
echo'</select></td>';
echo'</tr>';