Linked selects

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Darwood
Forum Newbie
Posts: 1
Joined: Sat Feb 03, 2007 1:32 pm

Linked selects

Post by Darwood »

Hi Guys

How can I create 2 drop boxes (select tags) that are linked using PHP?
ie The options available in the 2nd drop box depends upon the selection in the first box.

Example:
Box1 = Animal Type
Box2 = Breed
If the user selects 'Cat' in Box1 then the options in Box 2 are Persian, Tabby etc.
If the user selected 'Dog' in Box1 then the options in Box2 are Alsatian, Collie etc.


I have produced the PHP code to generate the first select tag but I'm not sure how I can make the 2nd box dependant upon the selection of the first. Is this even possible with PHP or will I need to learn a bit of client side script such as Javascript?

Thanks
Darwood
User avatar
louie35
Forum Contributor
Posts: 144
Joined: Fri Jan 26, 2007 8:40 am
Location: Dublin
Contact:

Post by louie35 »

have a look into AJAX dependent menu
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

search for "chained selects"
Post Reply