RE: [PHP] dynamic lists
| From: | Brad Fuller | Date: | Wed, 17 Jan 2007 21:39:12 +0000 |
| Subject: | RE: [PHP] dynamic lists | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247265@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Jay Blanchard [mailto:jblanchard@pocket.com]
> Sent: Wednesday, January 17, 2007 4:05 PM
> To: Don; php-general@lists.php.net
> Subject: RE: [PHP] dynamic lists
>
> [snip]
> By dynamic drop list I mean the type where the options
> contained in the subsequent list depend on what was picked in
> the previous list without clicking submit.
> [/snip]
>
> PHP is server side, you need to do this with AJAX or Javascript
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
Don,
There's a few different ways to do this.
#1) Submit the form (to itself) when a user chooses an option from the first
list (using onChange=form.submit()) then with PHP query the database for the
second set of options.
#2) Use JavaScript to store all the values and pop them in when the user
chooses an option from the first list (using onChange=someFunction(...)).
I like #2. If you need a starting point, google for "javascript dynamic
select list"
Hope that helps,
Brad