Forum Moderators: coopster
Im working on a form that will has 2 select menus. When the first is selected the second should be populated (Using MySQL).
This code works in Firefox beautifully, but I cannot get it to work in IE:
Java portion:
<script language="javascript">
function resubmit(){ document.form.action="result.php";
document.form.submit();
}
function process()
{
document.form.action="search.php";
document.form.submit();
}
</script>
HTML/PHP portion:
<form name="form" method="POST" action="results_search.php">
<input type="hidden" name="set" value="check" />
<input type="hidden" name="action1" value="event" />
<select name="event" onchange="resubmit()" >
<?php
echo $action1;
$query = "SELECT * FROM events WHERE year = $year";
$result = mysql_query($query);
//$num_rows = mysql_num_rows($result);
echo '<option>--Please Select--</option>';
while($row = mysql_fetch_array($result)){
$event=$row["Event"];
$reference=$row["Reference"];
if ($set == "check"){
//echo 'hello world';
echo "<option";
if ($reference == $value){
echo " selected=\"selected\"";
}
echo " value=\"".$reference."\">$event</option>";
}
else {
echo "<option value=\"".$row['Reference']."\">".$row['Event']."\n ";
}
} ?></select>
<td><select name="category" class="Event_List" id="category">
<?php
$query_sub = "SELECT DISTINCT class FROM details WHERE Reference = $value AND class <> '' ORDER BY class";
$result_sub = mysql_query($query_sub);
echo '<option>--Please Select--</option>';
while($row = mysql_fetch_array($result_sub)){
$subcategory=$row["class"];
echo "<option value=\"".$row['class']."\">".$row['class']."\n ";
}
?>
</select>
<td><input type="submit" onclick="process()" name="Go" /></td>
I think it is something to do with the way IE parses the javascript?
Any ideas why this doesn't work in IE?