Dynamic Dropdown Menus(AJAX/Javascript/PHP?)

Discussion in 'Programming' started by pasychosheep, May 12, 2008.

  1. #1
    I'm looking for a way to do some dynamic dropdown menus. Basically, I want a series of <select> style drop downs, with a new menu popping up after a selection on the previous dropdown has been made.

    Ie: if I select "Employed" on the first menu, a new menu will appear under it with a list of common jobs, whereas if I select "Student" on the first menu, a second menu will appear under it that has a list of schools, but if I pick "Bum" on the first menu, no further menus will pop up.

    The thing is, I'm not sure what the best method of doing this is. Here's what I need to be able to do for sure:

    Pull menu values from a MySQL database.
    Be able to submit values to a PHP script.

    That's really it, but I'm seeing AJAX methods, CSS methods, straight Javascript(which, I believe, is not very easy to transfer to PHP without appending the values to a URL upon form submission), and god knows what else. Anyone have any suggestions?
     
    pasychosheep, May 12, 2008 IP
  2. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If it were me, I would be using AJAX. So you would activate an onChange event on your select, then execute an AJAX call to display the appropriate subset.
     
    apmsolutions, May 12, 2008 IP