Creating drop down lists
am 10.03.2007 12:33:37 von scott
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 "
Re: Creating drop down lists
am 11.03.2007 03:29:59 von Manuel Lemos
Hello,
on 03/10/2007 08:33 AM Scott said the following:
> 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.
You may want to take a look at this forms generation class that comes
with a plug-in to link two or more select inputs just like you describe.
When the value of an select input changes, it triggers the switch of
options of the following select input depending on the value of the
previous select input.
There is a variant of that plug-in that retrieves the new options from a
MySQL database. It uses AJAX requests to avoid reloading the current page.
http://www.phpclasses.org/formsgeneration
Here is an example of the linked select input plug-in in action:
http://www.meta-language.net/forms-examples.html?example=tes t_linked_select
Here is a video tutorial with a section specifically about this plug-in:
http://www.phpclasses.org/browse/video/1/package/1/section/p lugin-linked-select.html
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Creating drop down lists
am 11.03.2007 21:21:04 von Bruce Cowin
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 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 =3D mysql_query("SELECT root FROM training");
echo "