i hv a questions i have two combo boxes one for states and other for districts . i wanted that whenever user select state from combo1 then only the districts of that state should show in combo2. i am a newbie and i am doing this simple thing in php..

1 answer

Kau-Boy 110
0
points

You can do that with PHP. In this case the user has to submit the form after chosing a state from the first select (or you submit it automatically with the onChange event handler on the select). In your PHP script you than create the second select with the districts.

Using AJAX you can even update the second select by sending the value of the first select to the server and than update the second select using the AJAX response. If you are new to AJAX I would recomment to take a look at Prototype or jQuery.

But you should still enable a user without JavaScript to use the selects with submitting the form.

If you need further help just ask.

Answered almost 9 years ago by Kau-Boy