Re: Auto populate subcategory select box based on category choosen
| From: | Jason Lavigne | Date: | Wed, 06 Dec 2000 07:28:00 +0000 |
| Subject: | Re: Auto populate subcategory select box based on category choosen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28742@lists.php.net to get a copy of this message | ||
This is not intended to sound rude in anyway, that question has nothing to
do with PHP and this is a PHP list, now with that said here is what I would
suggest;
You have two options, first you could resubmit the page when someone changes
the first dropdown box and using PHP you could regenerate the second list
based on the value from the first list. You can see this in action on
MapQuest
(http://www.mapquest.com/cgi-bin/ia_find?link=btwn/twn-map_form&event=no_map
&uid=u2o00cx3daq9i1ge:82hfys0f7) when the country is changed.
Second option would be to use DHTML and JavaScript to do it as seen on the
Microsoft Radio Station guide
(http://windowsmedia.com/radiotuner/default.asp) when you change the search
type.
Looking at source code for either will help you get started.
Jay
----- Original Message -----
From: "David" <fates-w@home.com>
To: <php-general@lists.php.net>
Sent: Tuesday, December 05, 2000 1:20 PM
Subject: [PHP] Auto populate subcategory select box based on category
choosen
> How do I populate 2nd select box that holds subcategories based on
previous
> select box which contains (categories). I need a simple example.
>
> Example:
>
> Select box 1 contains:
>
> Select your OS:(categories)
> Linux
> Windows
>
> Lets say user chooses Linux
>
> Select Box 2 (autopopulates with subcategories for Linux loaded from
> database: )
>
> program 1 for Linux
> program 2 for Linux
>
> Select box 1 contains categories and select box two will populate with
> subcategories based on the category choosen loaded from a MySQL database.
> The data is stored in a single database called database1 using one table
> that contains category and subcategory.
>
> I know I have to use javascript but I need a very simple example on how to
> do this.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>