How to create a form with 2 drop down list box in PHP, which is the second "drop down list box" relies on the results of the first "drop down list box"? I apologize if this question has been asked, but I could not find a similar question. Thank you in advance.
Sory, i'm a newbie. Here is my Code:
<script>
function reloadPage()
{
location.reload();
}
</script>
<form name="form1" action="updateitemstock.php" method="post">
<table border="0" width="50%">
<tr>
<td width="18%"><b><font face="Verdana" size="2" color="#FFFFFF">Select
Vendor</font></b></td>
<td width="18%"><select size="1" id=name="dvendor">
<option selected>Choose Vendor Name</option>
<?php
while ($row = mysql_fetch_array($vendor_list)) {
?>
<option value="<?php echo $row[0]; ?>" onclick="reloadPage()"><?php echo $row[0]; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td width="18%"><b><font face="Verdana" size="2" color="#FFFFFF">Select
Item</font></b></td>
<td width="18%"><select size="1" name="ditem">
<option selected>Choose Item Name</option>
<?php
if (isset($_POST['dvendor']) {
$item_list = mysql_query("SELECT DISTINCT itemdesc FROM item WHERE dealer=$_POST['dvendor']");
}
while ($row = mysql_fetch_array($item_list)) {
?>
<option value="<?php echo $row[0]; ?>"><?php echo $row[0]; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td width="18%" colspan="2">
<div align="center">
<table border="0">
<tr>
<td>
<input type="submit" value="Save" name="bsave"></td>
<td>
<input type="submit" value="Upload" name="bupload"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>