oo7ml — 2011-09-22T10:04:55-04:00 — #1
Hi, i am working on a site at the moment and i am trying to allow customers to build their orders using a "drop down menu / wizard" where each drop drown menu displays content based on the choice in the previous drop down menu...
As soon as a user chooses an option in the first drop down menu... a second drop down menu appears and the content is based on the users choice in the previous drop down... etc
I presume this type of function uses ajax and queries the database each time a selection has been made in the drop down menu...
Question 1: How should you design these in the database... do i need to create a single table for each option in the first drop down menu... or how should you design your product database
Question 2: If the answer is YES to the first question... i obviously need to store the contents of each drop down menu in the table, but do i also need to store the actual text labels indicating what each drop down is for on the actual order form, as they will also change based on the choice in the previous drop down menu...
I have spent the last hour trying to draw out what i mean below... these are not products i have on my site... i am just trying to demonstrate what i mean... i hope my diagram gives a better picture of what i am trying to achieve
thanks in advance for your help...
starlion — 2011-09-22T12:12:00-04:00 — #2
Let's call my two tables Options and Questions
Options are linked to questions directly.
1 "Yes or No"
2 "Then Yes"
3 "Then No"
Question_ID Next_Question_ID Text
1 2 "Yes"
1 3 "No"
starlion — 2011-09-22T10:07:37-04:00 — #3
were it me, i'd do it in 2 tables.
1 table to hold the question chain
1 table to hold the possible answers.
oo7ml — 2011-09-22T10:28:36-04:00 — #4
Thanks for your reply... but how would you link them with one another considering there will be different paths...