I am having a problem with drop down boxes in mysql
here is my code for the select box it works.....
<?
// script to display all the Employees in the Employees table
// connection information
$hostName = "xxxxxxx";
$userName = "xxxxxxx";
$password = "xxxxxxx";
$dbName = "xxxxxxxxxxxxxxxxx";
// make connection to database
mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");
// Select all the fields in all the records of the Employees table
$query = "SELECT distinct type, typeid
FROM Type
ORDER BY type";
$result = mysql_query($query);
// Determine the number of employees
$number = mysql_num_rows($result);
// Create drop-down menu of employee names
print "View inventory records for an employee:<p>
<form action=\"winerydisplay.php\" method=\"post\">
<select name=\"typeID\">
<option value=\"\">Select a wine</option>";
for ($i=0; $i<$number; $i++) {
$typeID = mysql_result($result,$i,"typeID");
$type = mysql_result($result,$i,"type");
print "<option value=\"$typeID\">$type</option>";
}
print "</select><input type=\"submit\" value=\"submit\"
name=\"submit\"></form>";
// Close the database connection
mysql_close();
?>
here is the code for my result page that doesn't work
<?
// script to display who has which computers
// connection information
$hostName = "localhost";
$userName = "xxxxxx";
$password = "xxxxxx";
$dbName = "xxxxxxxxxxxxxxxx";
// make connection to database
mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName");
mysql_select_db($dbName) or die( "Unable to select database $dbName");
// Select the fields from the appropriate tables
$query =
"SELECT * FROM Specialty, WineName, Label, Varietal, Type, Producer, Region, Country, Rating, Available, CasePrice, BottlePrice
WHERE
(Specialty.typeid = $typeID) and
(Specialty.winenameid = WineName.winenameid) and
(Specialty.labelid = Label.labelid) and
(Specialty.varietalid = Varietal.varietalid) and
(Specialty.typeid = Type.typeid) and
(Specialty.producerid = Producer.producerid) and
(Specialty.regionid = Region.regionid) and
(Specialty.countryid = Country.countryid) and
(Specialty.ratingid = Rating.ratingid) and
(Specialty.availableid = Available.availableid) and
(Specialty.casepriceid = CasePrice.casepriceid) and
(Specialty.bottlepriceid = BottlePrice.bottlepriceid";
$result = mysql_query($query);
// Determine the number of records returned
$number = mysql_numrows($result);
// Print the relevant information
print "There are $number records in the inventory:<p>";
for($i=0; $i<$number; $i++) {
$producer = mysql_result($result, $i, "producer");
$varietal = mysql_result($result, $i, "varietal");
print "$producer, $varietal<br>";
}
// Close the database connection
mysql_close();
?>