PDA

View Full Version : Dropdown box with data from Mysql


tintan
05-24-2004, 11:12 PM
Hi,
I am trying to create a Dropdown box which shud contain the values which I pick from a select query from the database. Can some one help me on this... as to how to write this HTML and php code in between each other.

<?php>
$select_query="select name from emp1";
$result=mysql_query($select_query);
while ($row=mysql_fetch_array($result))
{
echo $row["name"];
----- Here I want to put each of the value from d/b in my dropdown..-------
}
?>

azlatin2000
05-28-2004, 04:20 PM
<?php
$select_query="select name from emp1";
$result=mysql_query($select_query);
while ($row=mysql_fetch_row($result))
{
echo('<option value="'.$row[0].'">'.$row[0].'</option>');
}
?>