Jump to content

Drop Down Boxes that determines next options within a HTML Form


Rmck2010

Recommended Posts

Hi,

 

I was just wondering if anyone has a working example (I've tried hundreds of tutorials) of HTML / PHP code whereby the options within a drop down box, determine what is visible in the next one.

 

E.g - Drop Down one: Product Type --> Options are: Washer, Dryer, Fridge, Freezer, Oven.

 

If they select Washer, then drop down 2 should list the manufactuers of the washer.

 

Then in drop down 3 it should like the models depending on teh manufacturer.

 

The options need to be able to be stored in a MySQL database and transferred through PHP.

 

It's for my final year project - and im completley stuck!!! :'(

 

Please help! :-)

 

 

Cheers, Ruan

Link to comment
Share on other sites

Do a study of AJAX because that is the way to implement it.  To do this you need to add 2 languages to your list:

javascript and XML.

 

So what happens is this:

The user selects an item from the list.

Javascript calls a php function which queries the MySQL database using the parameter provided from javascript (which the user clicked on through the drop down) and the content is returned as XML.  Do some reading on AJAX (it really is pretty simple) and get some smaller stuff working with examples you find.  Work small until you get comfortable with it so you can build your page. 

Link to comment
Share on other sites

Hey Thanks AndrewGauger.

 

Unfortunatley I really don't have the time to do further study - the dealine is Thursday and I'm so behind schedule its unreal. My good friend is a member here and told me to try you guys as you are all genius' at this!

 

Have you or are you aware of any tutorials or examples of this in action? The drop down boxes aren't stored in the database - simply HTML drop down options which then selected that option is saved to the database via the form.

Link to comment
Share on other sites

Do a study of AJAX because that is the way to implement it.  To do this you need to add 2 languages to your list:

javascript and XML.

 

You don't need to know anything about XML to use AJAX.  Most common JavaScript frameworks / tools transfer data as JSON and PHP has JSON encode / decode functions.  So really all the OP needs to know is PHP, JavaScript, and the appropriate way of invoking an AJAX call with a popular framework like Dojo or jquery or whatever else exists out there.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.