Jump to content


Photo

Dropdown menu changes options in another


  • Please log in to reply
1 reply to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 21 February 2006 - 05:35 PM

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.



#2 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 21 February 2006 - 06:17 PM

But...

Since PHP is serverside, it cant tell what varible is selected in the javascript. I saw an suggestion to use the DOM and have javascript request something from the server, but thats too much work for what I am trying to do...

:)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users