"Quiz" using PHP and HTML
<p>I'm working on a personal project and part of the idea involves the user answering five questions and, depending on the responses, it will navigate you to one of the 3 different stories. I am currently using a simple quiz from <a href="http://css-tricks.com/building-a-simple-quiz/" rel="nofollow">CSS-Tricks</a> as a template and I've modified it to accept all answers as correct by using the elseif statement. The issue I have now is that I'm not entirely sure on how to make it point to one of the different files based on the responses.</p>

<p>The script works by asking questions (as you can see on the site, if you desire) which is output here, collected and displayed.</p>

<p>It's relatively simple in that all the "A" answers point to one story, all the "B" answers point to another and the same for "C". Obviously, due to the nature of the quiz I'm trying to edit, it wants to "grade" them rather than collect the results and make a decision based on that.</p>

<pre><code>&lt;?php

   $answer1 = $_POST['question-1-answers'];
   $answer2 = $_POST['question-2-answers'];
   $answer3 = $_POST['question-3-answers'];
   $answer4 = $_POST['question-4-answers'];
   $answer5 = $_POST['question-5-answers'];

   $responseA = 0;
   $responseB = 0;
   $responseC = 0;

   if ($answer1 == "A") { $responseA++; }
   elseif ($answer1 == "B") {$responseB++; }
   elseif ($answer1 == "C") {$responseC++; }

   if ($answer2 == "A") { $responseA++; }
   elseif ($answer2 == "B") {$responseB++; }
   elseif ($answer2 == "C") {$responseC++; }            

   if ($answer3 == "A") { $responseA++; }
   elseif ($answer3 == "B") {$responseB++; }
   elseif ($answer3 == "C") {$responseC++; }            

   if ($answer4 == "A") { $responseA++; }
   elseif ($answer4 == "B") {$responseB++; }
   elseif ($answer4 == "C") {$responseC++; }            

   if ($answer5 == "A") { $responseA++; }
   elseif ($answer5 == "B") {$responseB++; }
   elseif ($answer5 == "C") {$responseC++; }            

   if ($responseA) { echo '&lt;a href="sin.php"&gt;Next Page&lt;/a&gt;'; }
   elseif ($responseB) { echo '&lt;a href="mys.php"&gt;Next Page&lt;/a&gt;'; }
   elseif ($responseC) { echo '&lt;a href="ils.php"&gt;Next Page&lt;/a&gt;'; }

?&gt;
</code></pre>

<p>So, if anybody could point me in the right direction, I'd appreciate it. It sounded simple enough when I thought it up but it's far trickier than I planned for a learning project!</p>

<p><strong>EDIT</strong></p>

<p>I've updated the code to reflect cbronson's suggestions and it certainly works a lot better than before! The problem I have now is that it seems responseC is not being counted. The first two variable's are working perfectly and any combination of those will result in A or B but when I select even all C, it spits out the link to "mys.php" rather than with "ils.php".</p>

<p><strong>EDIT 2</strong></p>

<p>Got it working again. Silly, silly, silly. Thanks for all your help!</p>
