Need Help: Drop down script like country- state

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
rajsekar2u
Forum Commoner
Posts: 71
Joined: Thu Nov 20, 2008 4:23 am

Need Help: Drop down script like country- state

Post by rajsekar2u »

Hi guys...
Am creating a form in that am using two drop down list box's named category and subcategory
If i select an option from category drop down list, the corresponding values should show in the subcategory dropdown list...
I need to take both the values from database....

thanks in advance
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Need Help: Drop down script like country- state

Post by jaoudestudios »

Sounds like you have the right idea!
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Need Help: Drop down script like country- state

Post by jayshields »

You haven't posted a question. I'm assuming you just want us to make a script for you.

It can be done purely with PHP, if you don't mind damaging the user experience by requiring a page refresh after the first value has been chosen. Ideally, you'll want to use JavaScript, and possibly AJAX. I would stay away from AJAX for something this simple, and do it by fetching all the cats and subcats (this could become infeasible if you have a very large data set, and then you'd think about AJAX), and then just using Javascript to show the necessary subcats upon cat choice.
rajsekar2u
Forum Commoner
Posts: 71
Joined: Thu Nov 20, 2008 4:23 am

Re: Need Help: Drop down script like country- state

Post by rajsekar2u »

No... Just want to know which method to use for this..
i tried javascript but i cant get the result...
Post Reply