an issue with the drop down

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
swathin2
Forum Newbie
Posts: 4
Joined: Fri Jan 02, 2009 12:55 am

an issue with the drop down

Post by swathin2 »

hello everybody,

i am trying to learn php on my own and i have an issue with the drop down box in php. i would like to use 3 drop down boxes one for the state, second for the district and the third for the pincode.

when the page loads for the first time then only one drop down should be present and when the user selects any state then one more should appear automatically with the list of districts in that state and when the user selects the district then one more drop down should appear with the different pincodes available for that district.

like this it should be done automatically and should be visible only one after the other and the values should remain same in the drop down boxes.

if you do not understand this then you can imagine the selection of the category and sub category in any forum or journals.

so can any one guide me the process how can that be done.
User avatar
aditya2071990
Forum Contributor
Posts: 106
Joined: Thu May 22, 2008 11:30 am
Location: Hyderabad, India
Contact:

Re: an issue with the drop down

Post by aditya2071990 »

Actually, you don't need PHP for doing that, you can do it with javascript. Heck, you can simply use jquery!

Code in all the options and use hide() function on the district and pincode, then, depending on what the user has selected, simply use the show() function...

jQuery is very easy to learn, if you have any prior knowledge in programming, you can learn jQuery and achieve what I outlined above in half-a-day...

Here's the link for the jquery website: http://www.jquery.com
Post Reply