Re: Creating drop down lists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Your select is only selecting the field 'root' but then you're trying to get the field 'username' in your while loop.  So, you can add username to your select (or change it to *):

select root, username from training
select * from training



Regards,

Bruce

>>> Scott <sburcky@xxxxxxxxx> 11/03/2007 12:33:37 a.m. >>>
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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux