Forum Moderators: open

Message Too Old, No Replies

3+ interlinked dynamic drop downs

php, mysql, database, interface

         

j milo taylor

10:52 am on Mar 25, 2008 (gmt 0)

10+ Year Member



how can i create 3 or more interlinked dynamic drop-down menus that work in a non-linear way. connected to a mysql database, and using php?

for example,

drop down menu 1
select work type from (from mysql table 'works' )

which would restrict options in
drop down menu 2 ('year') and menu 3 ('country') to records matching that criteria

drop down menu 2
select year (from mysql table 'works') which working with menu 1 criteria restricts options in menu 3

drop down menu 3 ('country')
select 'country' (from mysql table 'works')

i want this to work in any order, so i could select menu 3 (country) first for example, then 1 (worktype) , which would restrict the options in menu 2 (year) and so on.

would such a solution be possible for more menus which query different tables?

stuartc1

4:51 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



It is certainly technically possible to do this - but the real ball-breaker is how to handle it sensibly. For example:

User select drop-down 1 (5th element), then drop-down 2 (3rd element), then drop-down 3 (2nd element). This is all well and good.... but what do you do if the user then changes the selection in drop-down 2 to the 8 th element (this may effect the previous selections in the other drop-downs), do you default the drop-down 1 and drop-down 3 back to the first element? if you do will the user know this?

I guess I'm trying to say that it could be messy and not user friendly. Keep things as simple as possible for the user and they data you collect from them will be more accurate.

j milo taylor

6:10 pm on Mar 26, 2008 (gmt 0)

10+ Year Member



thanks for the comment,

to work around this, would it be possible to have an asynchronous echo statement for each menu,

like

menu 1 - x is selected ¦ menu 2 - y is selected ¦ menu 3 - z is selected

returning to default if no matching records

echo confirm current x, y , z - then a submit form

milo