PHP/MySQL Dyanmic Dropdown boxes on a single page
Posted on 2003-12-09
I am writing a PHP/MySQL web application for an auto parts website.
I wanted to have 4 dynamic dropdown boxes that will update its display when the OnChange event is triggered. Values in the list are fetched from a MySQL database. These 4 dropdown boxes are:
Car Model entries will depend on the Car Make values, and the Car Parts entries will depend on the Parts Category. Say... If i select BMW as the Car make, it will update the Car Model dropdown box with BMW car models. Same thing applies to the Parts Category, say.. if I select Body Parts in the Parts Category, it will update the Car Parts dropdown box with body parts.
On every change or display update, they should be able to preserve the selected values on other dropdown boxes.
Once satisfied with the selections, the form will now be submitted to a second script for further processing.
If possible, this script should be to ITSELF only and is NOT a multi page script.
Please provide with a simple yet functional example of the code. Thank you very much and any help or thoughts are highly appreciated.