hi i'm having trouble creating a drop down menu using data from the database and i dont understand where the problem is
<?php
....
$conn ...blah blah blah...
mysql_select_db ...blah blah blah...
....
$query = mysql_query("SELECT * FROM teamdb WHERE sports='Basketball'");
$options = "";
while($row = mysql_fetch_array($query))
{
$teamid = $row["teamid"];
$teamname = $row["teamname"];
$options.="<option value=\"$teamid\">".$teamname."</option>";
}
....
?>
<html>
....
<select name='whatever'>
<option value=0> choose</option>
<?=$options?>
</select>
....
</html>
the drop down menu created from this code only has the choose option
and i dont understand whats wrong with it
can anybody help?
and after that is fixed
if i want to put that while loop into a function so i choose which sport to create the menu for.
i just need :
function selectteam ($where)
put the query ... while loop into the function
and change the WHERE field to '$where'
right?
thanks for any help in advance