Web Hosting Talk







View Full Version : PHP Drop down box


sam_cogan
10-11-2004, 10:59 AM
Im new to php and would be gratefull if anyone can help me get this sorted. Im trying to make a drop down box that is populated with the "type" value from a mysql table called "players" Having played around with lots of code, none of which works i'm now pretty confused and would be gratfull if anyone can help me out.

thanks

mattwade
10-11-2004, 11:13 AM
$query = "select type from players";
$result = mysql_query($query);
echo "<select name=\"type\">\n";
while($row = mysql_fetch_assoc($result)) {
echo "<option value=\"$row[type]\">$row[type]</option>\n";
}
echo "</select>\n";