Master - detail AJAX select boxes - AJAX server side script

Home - Tutorials - AJAX basic tutorials

In this tutorial I will present you how to create a master - detail select box in your forms. Select one item from the master field and the details will be filled accordingly to your selection.

Tutorial info:

Name:Master - detail AJAX select boxes
Total steps:4
Category:AJAX basic tutorials
Product:See complete product

Bookmark Master - detail AJAX select boxes

AddThis Social Bookmark Button

Step 3 - AJAX server side script

Master - detail AJAX select boxes

The server side script is responsible for reading the information from the $_GET array and regarding this send back the properly formatted response string. In this example we use simple hard coded values but of course here you can make a database call as well.

The code is very simple:

  1. <?php
  2. if (isset($_GET['brand'])){
  3. switch($_GET['brand']){
  4. case 'Audi' :
  5. echo "A3-1;A4-2;A6-3;A8-4";
  6. break;
  7. case 'BMW' :
  8. echo "320-1;520-2;630-3;745-4";
  9. break;
  10. case 'Mercedes' :
  11. echo "A180-1;C200-2;E320-3;S500-4";
  12. break;
  13. case 'Lexus' :
  14. echo "IS200-1;GS300-2;LS600-3";
  15. break;
  16. }
  17. }
  18. ?>

And now we are ready!

On the next page you can find the complete client side code. 

Previous Step of Master - detail AJAX select boxesNext Step of Master - detail AJAX select boxes

Tags: ajax select box, ajax master detail, master detail select box

Master - detail AJAX select boxes - Table of contents
Step 1 - The master - detail concept
Step 2 - AJAX to get details
Step 3 - AJAX server side script
Step 4 - AJAX master - detail select client side code

F1 Site Family
Database F1
Flash F1
Java F1
JavaScript F1
PhotoShop F1
Scripts F1
Tutorial F1
Windows F1

Family tutorials
PHP Array
PHP Redirect
PHP Session
MySQL Create User
Mysqldump Example
MySQL Concat
JavaScript String
JavaScript Timeout
JavaScript Tooltip

Total time: 0.0184