Jump to content

chained dropdowns


Karyna

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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.