SQL PHP HTML ASP JavaScript articles and free scripts to download
 

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 )

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

Download the ZIP file here  ajax-dd.zip

There are different ways to handle this script so we will be adding some better ways to handle this.



Further readings
Double drop down list on managing second list based on selection of first list
Enable second drop down list after selection of first list box
Double drop down list Frequently Asked Question
Manageing three drop down list
Double drop down list demo
Three drop down list demo
Adding options to a list box from database
Managing list box options from a period button
Retaining the form field values once the page reloads
Controlling second list box by using Ajax & PHP

Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
PHP Tutorials
PHP Monthly Planner
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.