This topic is locked

scoring questions

6/23/2006 5:57:24 PM
PHPRunner General questions
Allenh author

I'm having problems with the following...

I have a form, with multiple questions, each question has answers, a, b, c or d.

I need to apply a value to each answer so that I can score the questions.
I'm not sure what the most efficient way of doing this would be.
Thanks in advance for your help.

Alexey admin 6/26/2006

Hi,
You'll need a field "score" in the main table.

Then use Before record added event to implement this.

Here is the sample code:

$score=0;

if($values["answer1"]=="'a'")

$score=$score+1;

if($values["answer2"]=="'b'")

$score=$score+1;

...

$values["score"]=$score;



where answer1 and answer2 are your actual table fields.