Hi,
actually i've posted from the wrong thread and i apologize for that.
anyway, let me post my problem and it goes like this. we've successfully created drop down menus that is connected to our database. we have 5 fields to display, each field contains different data [(ex. first field contains - milk, soap, sardines, noodles and coffee),(second field contains - powdered milk, condensed milk, evap milk, spanish sardines, tomato sardines, laundry soap, bath soap, instant noodles, quick cook noodles, instant coffee and decafinated coffee)]. so its like when you choose milk on your first drop down, the second drop down should contain everything concerning milk, thus it should only show powdered milk, condensed milk and evap milk. Please help me... Thanks in advance.

Recommended Answers

All 3 Replies

Hi,
actually i've posted from the wrong thread and i apologize for that.
anyway, let me post my problem and it goes like this. we've successfully created drop down menus that is connected to our database. we have 5 fields to display, each field contains different data [(ex. first field contains - milk, soap, sardines, noodles and coffee),(second field contains - powdered milk, condensed milk, evap milk, spanish sardines, tomato sardines, laundry soap, bath soap, instant noodles, quick cook noodles, instant coffee and decafinated coffee)]. so its like when you choose milk on your first drop down, the second drop down should contain everything concerning milk, thus it should only show powdered milk, condensed milk and evap milk. Please help me... Thanks in advance.

You need to execute the php script which will fetch the milk related items from the DB when the milk is selected in the first drop down box.This can be done on change of the first select element through ajax.And the similar with the other one

Do as above. But, If you are a novice user and you find it hard to use ajax, then you can do the traditional way. Submit the form having an onchange event on all the dropdowns. When you select, say milk, from the first dropdown, submit the form, so $_REQUEST is available, which can be used to query the table to get all its related options, and so on.
As I said, its a traditional way and it will work. But, If you don't want to submit the form for each dropdown, then you *should* use ajax.

thanks a lot for the reply, i'll try doing your suggestion. hope it works on php coz as you've said ajax would be new to me. thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.