I am trying to create a dynamic drop down list using PHP and mysql database. I have written the following code and its giving me the output, but the problem is that its showing different drop-down menu for each item, I want all items in a single drop down list. Kindly check it and guide me.
$select_query= "Select name from category";
$select_query_run = mysql_query($select_query);
while ($select_query_array= mysql_fetch_array($select_query_run) )
{
foreach ($select_query_array as $select_query_display)
{
echo "
<select>
<option value='' >$select_query_display</option>
</select>
";
}
}
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…