Am I unable to find a suitable online quiz script? Yes/No/Maybe
April 19, 2006 6:42 PM   Subscribe

Online multiple choice/personality quiz script frustration.

Because I suck at writing script (in any language), I've spent the last couple of days searching for a ready-made multiple choice quiz solution that I can customise. However, despite the fact that what I want to do is embarrassingly easy, nothing I've found is appropriate, and although I'm able to do minor tweaks, I don't know enough javascript or php to be able to make what I want to happen actually happen.

Each question needs to have 3 possible answers: No (0 points), Maybe (1 point), Yes (2 points). The end result, one of three possible outcomes, will be based on the final overall points score, not on the most common answer. So if there are two questions, I answer No to the first and Yes to the second, my result should be the equivalent to having answered Maybe on both. Every script I've found so far simply returns the first most common answer, in this case No. Or else treats Yes as the correct answer, everything else as incorrect, and simply returns the number of correct answers.

Does anyone know of a ready-made solution for this? I don't expect anyone here to write the script for me, because I'm just doing this as a favour for someone else even more technically inept than myself, and she's just doing it for a laugh, so it's not like I have a budget. But if anyone knows of an off-the-shelf script that I can adapt, I'd be incredibly grateful.
posted by nylon to Computers & Internet (7 answers total)
The quickest thing would probably be to show us a script which you've seen and rejected because of the math issue. We'll tweak it for you. Whichever was the one you liked most, apart from how it calculated results, give us a link.
posted by AmbroseChapel at 7:50 PM on April 19, 2006

Check out PHPSurveyor - it will let you code in values of whatever you want for assessments. I was/am a scripting neophyte, and I found it incredibly easy to set up and work with.
posted by shelbaroo at 7:58 PM on April 19, 2006

If you don't need to host/store the test yourself, you can create tests exactly like you're describing with OKcupid (sign-up required). It allows you to track multiple variables, give different weightings to different answers, and so on. It's relatively neat. Not much opportunity for customising look/feel, however, so it'll come out looking a bit like this.
posted by so_necessary at 8:30 PM on April 19, 2006

Ok, the last script I tried is here, including comedy test questions. Ideally, if you selected two 'cat' options (0 points each) and two 'horse' options (2 points each), the quiz would tell you you're a dog, because that's the mean value. I'd be happy to think that a score of 0-2 meant you were a cat, 3-5 means you're a dog and 6-8 means you're a horse.

The component php files are in this text file (ignore the horrible html, it's not mine) - first it's the quiz set-up, then the results calculation, then at the end the questions and possible answers are set out in a separate array. It's obviously the calculation bit that's beyond me.
posted by nylon at 8:32 PM on April 19, 2006

Here's an adaptation of the results script which gives the kind of total you want, to be going along with.

It's actually much simpler than their version.

So, how does the math work exactly?

All cat (1 point) for four questions = a total of 4.

All dog (2) = 8.

All horse(3) = 12.

Forgive me for being obtuse but what's your algorithm for deciding which animal, say seven adds up to?
<html><head>    <title>Results: What animal are you?</title></head><body>    <?        $quiz = $_GET['quiz'];        $quizfile = $quiz.".qz";        $total_score = 0;        include($quizfile);        // Add up a total value from each question        for ($i=1; $i<=$questions; $i+=1)        {            $total_score += $_POST["q_$i"];        }	    ?>    <h2>Your Quiz Results add up to:        <?            echo $total_score;        ?>    </h2></body></html>

posted by AmbroseChapel at 10:35 PM on April 19, 2006

Excellent, excellent, that works like a dream. Thank you so much! As I'd said, I'm dealing with ranges, so I've just added a couple of lines to determine the category: basically, a score of 4-6 = cat, 7-9 = dog, 10-12 = horse. See the tweaked quiz in all its glory here. Thanks again!
posted by nylon at 6:39 AM on April 20, 2006

I am a dog. Well, we knew that already.

Happy to have helped.
posted by AmbroseChapel at 5:38 PM on April 20, 2006

« Older How can I prove I legally can play back copied...   |   J'adore l'amour et le soup de jour. Newer »
This thread is closed to new comments.