Hi,
I have a form which contains three dropdown menus. The second is dependant on the first dropdown but i can get it to automatically reload the second menu without me having to pressing the submit button:
<form name="program_search" action="task_management.php" method="get" > </p>
<table width="40%">
<tr><td> <font face="century gothic" size="2" color="black">Select Enhancement:</td></font>
<td> <select name="enhancement"><font face="century gothic" size="2" color="black" onChange="javascript:document.program_search.submit()">
<?php
//Run query to get data to populate drop down with
$query0 = "select distinct enhancement from enhancement order by enhancement;";
$result = @mysql_query($query0, $connection) or die("Unable to find perform $critea query, <br>$query0");
//add results into an array
$row = mysql_fetch_array($result);
//asign values from array into a variable
$enhancementname = $row['enhancement'];
echo "<option value=\"All\"><font face='century gothic' size='2' color='black'>All</font></option>";
//Loop through rest of records. inserting into drop down
echo "<option value=\"$enhancementname\"><font face='century gothic' size='2' color='black'>$enhancementname</font></option>";
while ( $row =@ mysql_fetch_array($result) ) {
$enhancementname = $row['enhancement'];
//add the value into the box
echo "<option value=\"$enhancementname\"><font face='century gothic' size='2' color='black'>$enhancementname</font></option>";
}
?></tr> </td></font>
<tr><td> <font face="century gothic" size="2" color="black">Select Task:</td></font>
<td> <font face="century gothic" size="2" color="black"><select name="task">
<?php
$enhancement1 = $_GET['enhancement'];
//echo $enhancement1;
//Run query to get data to populate drop down with
$query7 = "select distinct task from enhancement where enhancement = '$enhancement1' order by task ;";
$result = @mysql_query($query7, $connection) or die("Unable to find perform $critea query, <br>$query7");
//add results into an array
$row = mysql_fetch_array($result);
//asign values from array into a variable
$taskname = $row['task'];
echo "<option value=\"All\"><font face='century gothic' size='2' color='black'>All</font></option>";
//Loop through rest of records. inserting into drop down
echo "<option value=\"$taskname\"><font face='century gothic' size='2' color='black'>$taskname</font></option>";
while ( $row =@ mysql_fetch_array($result) ) {
$taskname = $row['task'];
//add the value into the box
echo "<option value=\"$taskname\"><font face='century gothic' size='2' color='black'>$taskname</font></option>";
}
?></tr></td></font>
<tr><td> <font face="century gothic" size="2" color="black">Select Program:</td></font>
<td> <font face="century gothic" size="2" color="black"><select name="prog_id">
<?php
$user = $_SESSION['td_id'];
//Run query to get data to populate drop down with
$query8 = "select program_id, program from program where td_id = $user order by program;";
$result = @mysql_query($query8, $connection) or die("Unable to find perform $critea query, <br>$query8");
//add results into an array
$row = mysql_fetch_array($result);
//asign values from array into a variable
$programid = $row['program_id'];
$program = $row['program'];
echo "<option value=\"All\"><font face='century gothic' size='2' color='black'>All</font></option>";
//Loop through rest of records. inserting into drop down
echo "<option value=\"$programid\"><font face='century gothic' size='2' color='black'>$program ($programid)</font></option>";
while ( $row =@ mysql_fetch_array($result) ) {
$programid = $row['program_id'];
$programname = $row['program'];
//add the value into the box
echo "<option value=\"$programid\"><font face='century gothic' size='2' color='black'>$programname ($programid)</font></option>";
}
?>
</td></tr></font>
</table>
<input name="add_button" type="submit" value="Search">
<input type="reset" name="Reset" value="Reset"></p>
</p>
</form>
What i'd like it to do is display all tasks if enhancements is select to 'All' and automatically change the tasks dropdown if another an individual enhancement is selected.
Does anyone have any suggestions?
Thanks in advance.
I have a form which contains three dropdown menus. The second is dependant on the first dropdown but i can get it to automatically reload the second menu without me having to pressing the submit button:
<form name="program_search" action="task_management.php" method="get" > </p>
<table width="40%">
<tr><td> <font face="century gothic" size="2" color="black">Select Enhancement:</td></font>
<td> <select name="enhancement"><font face="century gothic" size="2" color="black" onChange="javascript:document.program_search.submit()">
<?php
//Run query to get data to populate drop down with
$query0 = "select distinct enhancement from enhancement order by enhancement;";
$result = @mysql_query($query0, $connection) or die("Unable to find perform $critea query, <br>$query0");
//add results into an array
$row = mysql_fetch_array($result);
//asign values from array into a variable
$enhancementname = $row['enhancement'];
echo "<option value=\"All\"><font face='century gothic' size='2' color='black'>All</font></option>";
//Loop through rest of records. inserting into drop down
echo "<option value=\"$enhancementname\"><font face='century gothic' size='2' color='black'>$enhancementname</font></option>";
while ( $row =@ mysql_fetch_array($result) ) {
$enhancementname = $row['enhancement'];
//add the value into the box
echo "<option value=\"$enhancementname\"><font face='century gothic' size='2' color='black'>$enhancementname</font></option>";
}
?></tr> </td></font>
<tr><td> <font face="century gothic" size="2" color="black">Select Task:</td></font>
<td> <font face="century gothic" size="2" color="black"><select name="task">
<?php
$enhancement1 = $_GET['enhancement'];
//echo $enhancement1;
//Run query to get data to populate drop down with
$query7 = "select distinct task from enhancement where enhancement = '$enhancement1' order by task ;";
$result = @mysql_query($query7, $connection) or die("Unable to find perform $critea query, <br>$query7");
//add results into an array
$row = mysql_fetch_array($result);
//asign values from array into a variable
$taskname = $row['task'];
echo "<option value=\"All\"><font face='century gothic' size='2' color='black'>All</font></option>";
//Loop through rest of records. inserting into drop down
echo "<option value=\"$taskname\"><font face='century gothic' size='2' color='black'>$taskname</font></option>";
while ( $row =@ mysql_fetch_array($result) ) {
$taskname = $row['task'];
//add the value into the box
echo "<option value=\"$taskname\"><font face='century gothic' size='2' color='black'>$taskname</font></option>";
}
?></tr></td></font>
<tr><td> <font face="century gothic" size="2" color="black">Select Program:</td></font>
<td> <font face="century gothic" size="2" color="black"><select name="prog_id">
<?php
$user = $_SESSION['td_id'];
//Run query to get data to populate drop down with
$query8 = "select program_id, program from program where td_id = $user order by program;";
$result = @mysql_query($query8, $connection) or die("Unable to find perform $critea query, <br>$query8");
//add results into an array
$row = mysql_fetch_array($result);
//asign values from array into a variable
$programid = $row['program_id'];
$program = $row['program'];
echo "<option value=\"All\"><font face='century gothic' size='2' color='black'>All</font></option>";
//Loop through rest of records. inserting into drop down
echo "<option value=\"$programid\"><font face='century gothic' size='2' color='black'>$program ($programid)</font></option>";
while ( $row =@ mysql_fetch_array($result) ) {
$programid = $row['program_id'];
$programname = $row['program'];
//add the value into the box
echo "<option value=\"$programid\"><font face='century gothic' size='2' color='black'>$programname ($programid)</font></option>";
}
?>
</td></tr></font>
</table>
<input name="add_button" type="submit" value="Search">
<input type="reset" name="Reset" value="Reset"></p>
</p>
</form>
What i'd like it to do is display all tasks if enhancements is select to 'All' and automatically change the tasks dropdown if another an individual enhancement is selected.
Does anyone have any suggestions?
Thanks in advance.