1. Registered User
Join Date
Mar 2008
Posts
55

I making a personality quiz that goes like the following.

User takes a test to determine which type of person they are more like. So there will be say 5 types, each given a percentage of 100 that they are closest to at quiz end. The test has 50 questions, plus a age question and a sex question. Each test has 5 possible answers. The user clicks through radio button to fill out the quiz. No sweat so far.

My issue is in the test scoring, this is were i get confused. When making a test, each answer is weighted to fit a specific personality type. The weights are shown on screen as +6 thru 0 thru -6. (In code as 1-13, zero the default get 7 points). I have tried a few different scoring algos but non seem to be accurate. One other thing, I have to assume that a value other than zero WILL NOT be chosen when building a quiz.

1st try - Multiple count of all questions times 7 (7 is middle or 0 on scale), then divide by total points gotten from weighted answers. This ends up being something like 350/372 = 94%. This is all good till you get a score like 350/352 = 99%. In percentage you can assume that the second score is higher, but in reality the first score had the greater point spread.

2nd try - Add the highest value (up to 13) from each questions answers together for each personality type, then divide by total points gotten from weighted answers. This ends up something similar to the above try, but with higher percentages going to those personality types with answers that have no weights attached to them.

OK so now that i have written this Im really thinking that the quizzes will not work if weights are not set to other than zero (aka 7 points). Am I totally off here? Can anyone lead me in a proper direction. Thanks much for helping my keep what hair is left on my head.

Cesar

Join Date
Mar 2007
Location
010101010110100
Posts
803
Why can't you use session variables to help you with this? Store the answers into session vars then call them out when you need them. You should be able to do your math on them from there.

3. Registered User
Join Date
Mar 2008
Posts
55
storing the variables is not my issue. its how to do the math at the end. please re-read my post again if you want to help again. please.... still pulling hair out.

Join Date
Nov 2004
Location
out on a limb
Posts
13,692
sounds like you need to consider media/mode calcualtions or even a standard deviation

5. Registered User
Join Date
May 2008
Posts
10

## RE: Scoring a Quiz

Oi... Don't be afraid to use 0's and 1's. Computers take very kindly to this concept

Your problem isn't PHP code, either, it's math. And I understand, when ever I get things too complexed out in my mind I go balistic. I'm very simple minded.

This is what you gotta do.

B R E A K IT D O W N

Maybe this example can help:

PHP Code:
``` <?php print "<center>"; print "<h1>What kind of pet are you?</h1>"; print "<em>Let's Find Out!</em>"; if(!\$_REQUEST['done']) { print "<form action='". \$_SERVER['PHP_SELF'] ."' method='post'>"; print "<input type='hidden' name='done' id='done' value='1'>"; print "<br>"; print "How do you feel about hair all over the furniture?"; print "<SELECT name='q1' id='q1'> <option value='1'>Doesn't Bother Me</option> <option value='0'>Don't Like it at All</option> </select>"; print "<br>"; print "Do you enjoy walking 30 minutes everyday?"; print "<SELECT name='q2' id='q2'> <option value='1'>Sounds great!</option> <option value='0'>Not quite me.</option> </select>"; print "<br>"; print "Do you hate constant noise?"; print "<SELECT name='q3' id='q3'> <option value='0'>Yes!</option> <option value='1'>Nope!</option> </select>"; print "<br>"; print "Are caged animals rediculous to you?"; print "<SELECT name='q4' id='q4'> <option value='0'>Yes</option> <option value='1'>No</option> </select>"; print "<br>"; print "Do you like it when your house reeks like rodent crap?"; print "<SELECT name='q5' id='q5'> <option value='1'>Oh Yeah!</option> <option value='0'>Yuck Eww What? No!!</option> </select>"; print "<br>"; print "<input type='submit' name='submit' id='submit' value='Check  Answers!'>"; print "</form>"; } else { print "<br>"; \$q1=\$_POST['q1']; \$q2=\$_POST['q2']; \$q3=\$_POST['q3']; \$q4=\$_POST['q4']; \$q5=\$_POST['q5']; \$total=5; \$result=(\$q1+\$q2+\$q3+\$q4+\$q5); print "Score: <b>\$result/\$total</b><br>"; if(\$result==5) { print"You're indeed a dog person!!"; } if(\$result==4) { print "Dog or cat maybe?"; } if(\$result==3) { print "A pet bird may be in order.."; } if(\$result==2) { print "Settle for a guinne pig."; } if(\$result==1) { print "Get small mice just so you can feed them to a pet snake  because you hate animals!"; } if(\$result==0) { print "I don't know how you got to this page, but you really don't  like animals!"; } } ?> ```
This application takes a peek at your unique personallity and tells you what kind of pet you should get. It asks 5 questions about animals, and has a total of 6 responses which tell you how to live! Just like the forms you see on myspace etc. Very simpled down.

On some questions, the points are reversed to the negative answer, to throw off the person taking the poll. Like this: Do you hate noise?
you get a point for saying "Nope!" and 0 points for saying "Yes!"
If all the points add up, you should get a dog. If you end up with no points, then you shouldn't get any animals at all. There are 6 possible outcomes.
Last edited by s-p-n; 07-17-08 at 17:44.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•