Creating drop down lists
| From: | Scott | Date: | Sat, 10 Mar 2007 11:33:37 +0000 |
| Subject: | Creating drop down lists | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-43239@lists.php.net to get a copy of this message | ||
Hi everyone!
I would like to create a drop down list with the info in my database.
I would also like to have more options so it will filter down to many
rows of data displayed then filtered down to a few rows of data that
said user is looking for.
Kind of like select a state then in the next box you can select the city.
but first thing is first.....
I have tried a few things out there that I searched for but everything
I tried it will not populate the drop down list with the data in my
database.
So I know it somewhere along the lines of:
$query = mysql_query("SELECT root FROM training");
echo "<form action=something.php method=POST><select name=Field>";
while ($r = mysql_fetch_array($query))
{
$user = $r["username"];
echo "<option value=$user>$user</option>";
}
echo "</select>";
or something like that but nothing populates....
What is the proper code to get this done to populate and display what
I select from the drop down menu?
Say my DB name is: TUBA
My table name is: FLUTE
and I have xxx amounts of rows to filter through with three columns in
my mysql db.
Does that all make sense?
Thanks in advance!
You all rock!!
sb
--
AOL IM: Jestrix1