i cannot understand why this will not work, it works if i hard-code the city name in, though; and i can see that it is being passed by the GET in the form that calls it; but no categories show up in the drop down i am using...
$sql = mysql_query("SELECT category FROM restaurant WHERE city = '$choose_city');
script that call it:
<html>
<body>
<?php
$connection=mysql_connect("localhost","test","test01");
if (!$connection) {
echo "Could not connect to MySql server!";
exit;
}
$db=mysql_select_db("test",$connection);
if (!$db) {
echo "Could not select database";
exit;
}
function catlist(){
$sql = mysql_query("SELECT city FROM city");
echo "<select name=\"choose_city\">";
while(list($city)=mysql_fetch_array($sql)){
$city_name = stripslashes($city);
echo "<option value=\"$city_name\">$city_name</option>";
}
echo "</select>";
mysql_free_result($sql);
}
// The Form:
echo "<form method=\"post\" action=\"choosecategory.php\">
Select:";
catlist();
echo "<input type=\"Submit\" Value=\"Submit\">
</form>";
?>
</body>
</html>
thanks in advance