Display Records In A Drop Down Menu Combo Box From A Column Of A Table In PHP
<?php
$con = mysql_connect('localhost','root','');
$db =
mysql_select_db('mydb');
//$res = mysql_query("SELECT * FROM songs ORDER BY title") or die ("Invalid query: " . mysql_query());
//$res = mysql_query ("SELECT * FROM mytable ORDER BY name") or die ("Invalid query: " . mysql_query());
$res = mysql_query ("SELECT * FROM mytable") or die ("Invalid query: " . mysql_query());
echo '<label>Select value: </label>';
echo '<select id="email" name="email">';
echo '<option value="">Select Email</option>';
while ($row = mysql_fetch_assoc($res))
{
// $va = $row['title'];
$va = $row['email'];
echo "<option value='$va'>$va</option>";
}
echo '</select>';
?>