Question:
setting the selected value of a drop down box using php and mysql database?
2011-08-16 22:51:06 UTC
hello .. m trying to get/fetch the database value into dropdown box as a selected value in the dropdown box using PHP script and mysql - phpmyadmin database ..

but m having problems in it .. here is my script which i m using ..


----------------------------------------------------------------------------------------------------
try.php
-------------------------------------
$conn = mysql_connect("localhost","root","") or die("could not connect to localhost");
mysql_select_db("test") or die("could not connect to database");
$qry = "select * from table1 where id=1";
$result = mysql_query($qry) or die(mysql_error());

while($rows = mysql_fetch_array($result))
{
$myDate=$rows['date'];
?>
Date :


}

}
?>
----------------------------------------------------------------------------------------------------

m getting the BLANK DROPDOWN BOX as soon as i run my webpage ..

please suggest me whats wrong m doing here ..
Three answers:
2011-08-16 23:12:07 UTC
Build a string using the php and display it later. So :

$option_str = "