hi all
i'm relatively unexperienced in using html, php mysql or java so excuse me if i ask stupid questions
i can read most of the code fine but when writing syntax could be the problem.
i'd like to create drop down menus based on selection of the menu before. here is peace of code i've found on the web. works fine on firefox but not in IE or chrome.
here is the test: http://gec.servebeer.com/servis/gec/test.php
first drop down is showed and populated from mysql as it should but second drop down is not showing on IE or chrome.
here is the code:
<?php
//seeming that we are just submitting and refreshing to the one page we need to check if the post variable is set, and if so a couple of other variables are set
if(!isset($_POST['make'])) {
$next_dropdown = 0;
}
else {
//This variable when set reveals the next drop down menu
$next_dropdown = 1;
//this variable keeps the previous selection selected so you kno wat you are editing
$selected = $_POST['make'];
}
?>
<html>
<head>
</head>
<body
<!--I left the action blank to refresh itself-->
<form name="form" method="post" action="">
<select name="make" style="background-color: #008000; color:#FFFFFF;">
<option value="NULL">Select Make</option>
<?php
$con = mysql_connect("localhost", "root", "letmein");
mysql_select_db("car", $con);
$query = "SELECT makeID, car_make FROM make ORDER BY makeID ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_NUM))
{?>
<option value="<?php echo $row[0]; ?>" onClick="document.form.submit()" <?php if(isset($selected) && $row[0] == $selected) {echo "selected='selected'";} ?>><?php echo $row[1]; ?></option>\n";
<?php }
echo '</form>\n';
//this is where the other form will appear if the previous form is submitted, ultimately you can keep these fields in the same form you just need to make a way to distinguish the updated form or even perhaps just dynamically change the name of the form and do a switch statement
if($next_dropdown == 1) {?>
<form name="form2" action="" method="post">
<select name="engine">
<option value="NULL">Select Engine</option>
<?php
$result2 = mysql_query("SELECT engineID, engine FROM engine ORDERBY engineID ASC");
while($row2 = mysql_fetch_array($result2, MYSQL_NUM))
{ ?>
<option value="<?php echo $row2[0]; ?>" onClick="document.form2.submit()"><?php echo $row2[1]; ?></option>
<?php }?>
</select>
</form>
<?php }
?>
</body>
</html>
any thoughts why this is not working on IE and chrome?
thx