hi i want to be able to generate drop down menu's based on the database information
these are the table information :
+--------+------------------+------------+
| tid | tname | sport |
+--------+------------------+------------+
| 10000 | Boston Celtics | Basketball |
| 10001 | New Jersey Nets | Basketball |
+--------+------------------+------------+
+-----------+-----------------+--------+
| aid | aname | tid |
+-----------+-----------------+--------+
| 20000 | Ray Allen | 10000 |
| 20001 | Carlos Arroyo | 10000 |
| 20002 | Jordan Farmar | 10001 |
| 20003 | Brook Lopez | 10001 |
+-----------+-----------------+--------+
i need to build the drop down menu's from the database so if i add,delete, or update something in the tables the drop down menu's will still populate.
the teams will be one separate menu and the athlete will be another group
so i will have to build 3 menus from these tables
one for team , and 2 for athlete right?
and of course when i select boston celtics, only the athletes from boston celtics will show up
so i will need to hide and disable all other menus or something
and i have another set of radio buttons to select which sport
i'm stuck on how to combine? these codes to make it work
thats what i think i need to do
<html>
....
Select Team:
<select id='select_team1' name='team1' onchange='teams1()' style='display:none'>
<option selected='selected' value='0'>Select a Team</option>
<?php
$query = mysql_query("SELECT * FROM teamdb where sports='Basketball'");
while($row = mysql_fetch_array($query))
{
echo '<option value='.$row['teamid'].'>'.$row['teamname'].'</option>';
}
?>
</select>
....
</html>
<html>
....
Select Player:
<select id='select_player' name='player1' style='display:none'>
<option selected='selected' value='0'>Select a Player</option>
<?php
$query = mysql_query("SELECT * FROM athletedb where teamid='10000'");
while($row = mysql_fetch_array($query))
{
echo '<option value='.$row['athleteid'].'>'.$row['athletename'].'</option>';
}
?>
</select>
....
</html>
thanks in advance for any help.
an additional question:
this will be used in a form so how will it affect the php thats receiving these values?