View Full Version : Drop down menu from sql database.
simjay
04-08-2007, 05:57 PM
I havent done one of these before, can any one help?
echo "<select name='book_topic'>
<option value='$topic_id'>$topic_name</option>
</select>"
Thank you
Len Whistler
04-08-2007, 06:02 PM
This might help.
<select name="">
<?
while($row = mysql_fetch_array($sql)){
echo "<option value=\"$row[0]\">$row[0]";
}
?>
</select>
simjay
04-08-2007, 06:07 PM
That just comes up with a new dropdown menu for each one, i now have a new drop down for each entry.
Len Whistler
04-08-2007, 06:31 PM
That just comes up with a new dropdown menu for each one
Title of thread Drop down menu from sql database.
simjay
04-08-2007, 06:38 PM
well done you read the title
Len Whistler
04-08-2007, 06:40 PM
well done you read the title
So what do you want?
simjay
04-08-2007, 09:20 PM
ONE drop down menu with all the options from the table. Not a drop down menu for each option. Done it now thank you any way!!!!!!!
rafiki
04-08-2007, 10:28 PM
try looking up mysql_num_rows
and add something like
while ($rows <= mysql_num_rows($sql)) {
echo "<option value=$row[0]> $row[0]</option>";
$row++
}
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.