Aloha,
The partly script below read a database content and create a drop down list, prior to that part I have a variable $choose, how can I make one of the selection as the selected one which will be the same content as $choose.
Script:
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'snake';
$table = 'main';
$link = mysql_connect($host,$user,$pass);
if(!$link) die(mysql_error());
$select = mysql_select_db($db);
if(!$select) die(mysql_error());
$query = "SELECT DISTINCT species FROM main ORDER BY species";
$result = mysql_query($query);
if(!$result) die(mysql_error());
/*echo "<select name=\"species\">\n";
echo "<option value=\"\"> </option>\n";*/
while($row = mysql_fetch_array($result))
{
echo "<option value='".$row['species']."'>".$row['species']."</option>\n";
}
echo "</select>\n";