I'm trying to create a drop down menu that is populated by a mySQL table. The table is three columns: ID, Breeds, Sizes. I want the drop down menu to be populated by the Breeds table. One the user selects a Breed from the list I want the appropriate "Size" to be displayed. So far I have been able to populate the menu with the Breeds, but I haven't figured out how to display the results of the selection. Here is what I have so far:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<form name = "form" action = "haltiresults2.php" Method = "POST">
<select name="selObj" onChange="MM_jumpMenu('parent',selObj,0)">
<option selected>Select Breed</option>
<?
$username = "username"; // The username you created for this database.
$password = "password"; // The password you created for the username.
$usertable = "Halti_Sizes"; // The name of the table you made.
$dbName = "DatabaseName"; // This is the name of the database you made.
MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
@mysql_select_db( "$dbName") or die( "Unable to select database");
$query = mysql_query("SELECT * FROM Halti_Sizes ORDER BY 'Breeds' ASC");
while($row = mysql_fetch_array($query)) {
print '<option value="haltiresults2.php?ID='.$row["ID"].'">'.$row["Breeds"];
}
?>
</select></form>
I'm not sure what I'm doing wrong. The "ID" shows up in the URL of the second page "haltiresults2.php" , but I can't figure out how to get it to display any of the information that corresponds to that ID.
Does anyone have any suggestions. Any help would be greatly appreciated!!! Thank you so much!