Rmck2010 Posted April 26, 2010 Share Posted April 26, 2010 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 Quote Link to comment Share on other sites More sharing options...
andrewgauger Posted April 26, 2010 Share Posted April 26, 2010 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. Quote Link to comment Share on other sites More sharing options...
Rmck2010 Posted April 26, 2010 Author Share Posted April 26, 2010 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. Quote Link to comment Share on other sites More sharing options...
andrewgauger Posted April 26, 2010 Share Posted April 26, 2010 Try this out (found by googling ajax dropdown) http://www.phpclasses.org/package/3594-PHP-Update-the-options-of-a-select-input-using-AJAX.html Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted April 27, 2010 Share Posted April 27, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.