How to display results of SQL Query as a dropdown menu?
Posted: Tue Mar 03, 2009 10:18 am
Hey Guys, me again!
I have got the following code, it seems to work, but the only problem is, it displays two separate dropdown menus.
I would like both of the records to appear in the same drop down menu.
Can anyone help?
I have got the following code, it seems to work, but the only problem is, it displays two separate dropdown menus.
I would like both of the records to appear in the same drop down menu.
Can anyone help?
Code: Select all
$query = "SELECT * FROM Job_Spec";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$Project_Name= $row['Project_Name'];
echo"
<h1 class='title2'>Upcoming Project Roles</h1>
<p>From the menu below please select the Project Role:</p>
<form id='form2' method='post' action=''>
<p>
<label>
<select name='job' id='job'>
<option value>'$Project_Name'></option>
</select>
</label>
</p>
</form>
";
}
?>