Karyna Posted May 4, 2012 Share Posted May 4, 2012 hi everyone i have a question i tought was easy but im having some problems i have 3 dropdowns menus the customer select one category from one of them.. let say "pets" the the other dropdown must be filled with pets (dogs, cats, parrots...) if the customer select dogs the 3rd dropdown must filled with (doberman, bulldog,chihuhaua, etc) i think u got the idea.. but im having trouble with the 2nd and 3rd dropdown... any ideas::: tnx in advncd Quote Link to comment https://forums.phpfreaks.com/topic/262088-chained-dropdowns/ Share on other sites More sharing options...
dmikester1 Posted May 4, 2012 Share Posted May 4, 2012 Sounds like something you could do with javascript/jquery/ajax. I'm not sure if that is possible with just PHP though. Unless they select the first dropdown and hit a submit button, but that would be cumbersome for the user. Someone correct me if I am wrong. Mike Quote Link to comment https://forums.phpfreaks.com/topic/262088-chained-dropdowns/#findComment-1343144 Share on other sites More sharing options...
Barand Posted May 4, 2012 Share Posted May 4, 2012 If you 3 hierarchic db tables containing the data then the "baaSelect" link in my sig could help (provided the ids are numeric). Otherwise AJAX is the way to go Quote Link to comment https://forums.phpfreaks.com/topic/262088-chained-dropdowns/#findComment-1343149 Share on other sites More sharing options...
Drummin Posted May 4, 2012 Share Posted May 4, 2012 It can be done with submission using <select name="pets" onchange="this.form.submit()"> if all processing is done on the same page. All posed values are echoed back to the form. You then add if (isset($_POST['pets'])){ //Show subcat selection } Then Again for the subcat post. You'll need to name you "submit" button so full processing is only done when the button is clicked. I've done this type of multi selections on a number of sites and it's worked well. Quote Link to comment https://forums.phpfreaks.com/topic/262088-chained-dropdowns/#findComment-1343155 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.