Storing a selection from a php dropdown derived from mySQL
Posted: Tue Sep 08, 2009 5:05 pm
Very new to php and would like to know how I can store the selection from a dropdown box into a variable for use later. I have managed to create the dropdown from my MySQL db but don't know how to put this value into a variable. Code so far is:
Code: Select all
<?
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("ff") or die(mysql_error());
$result = mysql_query("SELECT * FROM players");
$sql = "SELECT DISTINCT team FROM players";
$team=mysql_query($sql);
$options="";
echo '<select hteam="team"><option>select team</option>';
while($row=mysql_fetch_array($team)) {
$thing=$row['team'];
echo '<option>'.$thing.'</option>';
}
?>