|
Posted by larry on 09/30/06 20:30
MS wrote:
> I am about to embark upon a function(s) that will ask a series questions of
> the user and dependant upon their reply to each the flow of questions
> changes.
>
> EG.
>
> Do you have Hair?
>
> if they answer "No" I want the next question to be {
> Move to next question
> }if they answer "Yes" I want the next questions to be {
> How long is your hair?
> What colour is your hair?
> etc...etc..
> }
>
> // This is next question
> How tall are you?
>
> So the question flow changes depending on what is answered.
>
> What I am asking is if anybody has designed such a system that is all
> database driven (so I am not writing conditions for each question) or
> anybody got any ideas of the database structure.
>
> MS
I see this working from a list of some sort (array?), just think of
programming LI tags you go deeper based on response.
Here is a crude structrure
Do you have hair, havehair
-havehair?yes
--What Color is it, haircolor
--How Long is it, hairlength
How tall are you, height
-height?>0
etc.
You would have extra data like question ID, or indicator of question or
conditional result, etc. table would be something like participant_ID,
survey_question_id, survey_answer.
As for premade programs, check out phpsurveyor, though if you have lots
of questions it could be rather tedious to enter it in as well as do
the survey through it.
Larry
Navigation:
[Reply to this message]
|