If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > Multiple menu selects each dependent on the one above

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-13-10, 09:33
henry.oswald henry.oswald is offline
Registered User
 
Join Date: Jun 2010
Posts: 1
Multiple menu selects each dependent on the one above

Hi I'm trying to create a simple page with three menu select drop downs, the choices available are dependent upon what was selected in the previous drop down.

E.G.
1st display food types,
the user selects FRUIT

2nd Displays Fruit types
the user selects Apples

3rd displays apple types
the user selects an apple.

I have got this working between the first and second menus, by writing a Jquery function to $_POST the select choice through to a php scripted file which generates the html code.

However it doesn't work between the 2nd and 3rd menus, I believe because the html code for the second drop down is being generated from a separate php file and displayed using javascript. Could someone point me towards how I should tackle this problem or point me towards an example please?

Thanks for your help, I am currently trying to teach myself basic web development so sorry if I got some terminology wrong!
Reply With Quote
  #2 (permalink)  
Old 06-14-10, 08:50
saviola saviola is offline
Registered User
 
Join Date: Jun 2010
Posts: 6
My opinion is the best way to do this is with Ajax requests in everyone choice.
What I mean - every time I change Select one Ajax request is sent to the php file which is processed and returned as an answer the data or html to filling the second Select statement.
Here you are some links for examples:
Auto-populating Select Boxes using jQuery & AJAX
Chained select boxes
Using Ajax to Populate a Select Box in CakePHP - James Fairhurst
Reply With Quote
Reply

Tags
drop down, jquery, menu select, php

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On