I have already tried doing this..
<?php
$A1 = $_POST['question-1-answers'];
$A2 = $_POST['question-2-answers'];
$A3 = $_POST['question-3-answers'];
$answer1 = $_POST['question-1-answers'];
$answer2 = $_POST['question-2-answers'];
$answer3 = $_POST['question-3-answers'];
$totalCorrect = 0;
if ($answer1 == "X") { $totalCorrect++; }
if ($answer2 == "X") { $totalCorrect++; }
if ($answer3 == "X") { $totalCorrect++; }
if ($answer5) { $totalCorrect++; }
echo "Your answer for question 1 was: $A1<br> ";
echo "Your answer for question 2 was: $answer2 <br>";
echo "Your answer for question 3 was: $answer3 <br>";
echo "<div id='results'>$totalCorrect / 3 correct</div>";
?>
But it does not seem to work. What I am trying to achieve is that the answer is a set variable at the moment (100% working as $answer1/2/3 but not sure as $A1/2/3). To then show them what they answered. Any ideas on how to do this. I know the POST part works because if the answer is correct, the total correct tally goes up. Any ideas. I have tried fiddling and adding the $A1 variables etc.
Code with form:
<form action="##.php" method="post" id="quiz">
<ol>
<li>
<h3>XXX</h3>
<div>
<label for="question-1-answers-A">Answer:</label>
<input type="text" name="question-1-answers" id="question-1-answers-A" placeholder="XXX" />
</div>
</li>
<li>
<h3>XXXX</h3>
<div>
<label for="question-2-answers-A" id="question-2-answers-A">Answer:</label>
<select name="iPhone" id="question-2-answers" name="question-2-answers">
<option id="A" value="A">XXX</option>
<option id="B" value="B">XXX</option>
<option id="C" value="C">XXX</option>
<option id="D" value="D">XXX</option>
</select>
</div>
</li>
<li>
<h3>XXX</h3>
<div>
<input type="radio" name="question-3-answers" id="question-3-answers-A" value="A" />
<label for="question-3-answers-A">A) X</label>
</div>
<div>
<input type="radio" name="question-3-answers" id="question-3-answers-B" value="B" />
<label for="question-3-answers-B">B) X</label>
</div>
<div>
<input type="radio" name="question-3-answers" id="question-3-answers-C" value="C" />
<label for="question-3-answers-C">C) X</label>
</div>
<div>
<input type="radio" name="question-3-answers" id="question-3-answers-D" value="D" />
<label for="question-3-answers-D">D) X</label>
</div>
</li>
</div>
<button id="myButton" class="float-center submit-button" onClick="setCookie()" >Next Page</button>
"); – broch Oct 13 '14 at 18:06