|
Posted by maxvalery on 05/05/06 17:25
Hi,
Here's a worthy challenge for ya'll. I'm trying to build a
questionnaire in php and need help understanding the logic behind the
process. Here's an example that explains everything:
1) What quality is most important to you in a car?
a) Reliability
b) Affordability
c) Large size
2) How important is gas mileage?
a) Very important
b) Not at all important
If a user chooses 1a, 2b, the program writes "you will probably like a
Volvo SUV (reliable, gas-guzzling)".
If a user chooses 1b, 2a, the program writes "you will probably like a
Chevrolet Cavalier (cheap, efficient)".
If a user chooses 1c, 2b, the program writes "you will probably like a
GMC Yukon SUV (large, gas-guzzling)".
If a user chooses 1a, 2a, the program writes "you will probably like a
Honda Civic compact (reliable, efficient)".
.... and so on ...
Basically, a user makes some radio-button choces, and the script
matches the choices to some database records filled with vehicle
information. Because I want to have more than 2 questions, I can't
even begin imagining the difficulty of hard-coding all possible choices
- behold the power of a factorial :)
What would be the logic/algorithm for something like that? What would
be the database structure?
Navigation:
[Reply to this message]
|