Child

Two related drop down list by using Ajax & PHP


Please read the  basic drop down list box control  tutorial. We will try to develop similar functionality by using Ajax (asynchronous JavaScript and XML) and PHP. The biggest advantage of using Ajax here is we need not reload the page again. With more form components ( if already filled by visitor ) we have to re-fill all the data once the page reloads. Now without sending all the information back to server we can send only cat_id of selected first category and then we will manage the second list based on cat_id value. 

The detail tutorial on how to start with Ajax or how it works along with PHP is not explained here. This demo script you can download the sample code along with table structures – data at the end of this file in zip format. 

You can see the demo here and check the other related articles on this related drop down list at the end of this page. 

We have used one server side script written in PHP. You can see the code of this file in your zip file ( download link at the end ) 

Submit this form and see how the form components data are available in action page of the form. This script will be further improved.

Directions: Simply download ajax_drop_down.zip, which contains all the files