Jump to content

Dropdown menu changes options in another


SharkBait

Recommended Posts

Hi,

I've been looking around and I can not seem to find a simple enough example of what I want to do with javascript and drop down menus.

With my first <select> I generate the menu from a PHP array (string and string)

depending on what item the user clicks on I want it to populate a corrisponding <select> with another array that is set using PHP

I could probally do this with $_GET after selecting the first option, but I would rather have it load the 2nd <select> without reloading the page. There are other form elements that I dont want the user to have to re-enter :)

Why does this seems harder than I thought it would?

Would I use the OnChange option for the <select> then pass the value of the selectedindex? I am thing unsure how would I go about having javascrip update the 2nd <select> by populating it with one of the indexes from a multidimention array based on the first <select>

Hopefully that makes sense.

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.