Hi there, im an infant when it comes to php, and only know a little. So please bare with me if my answers and explaining is slow.
Ive got a list of exam questions, each have four answers (selected by 4 radio buttons), this is held in mysql by ExamID, QuestionID, ExamAnswerA, ExamAnswerB, ExamAnswerC, ExamAnswerD.
all questions to a particular exam are listed using online.php?id=1 (where id = the examID)
ive split the exam questions up in to pages of 5 using this code
<?php
if ($page > 1)
{
$prev = ($page - 1);
echo "<a href=\"OnlineExam.php?id=$id&page=$prev\">Previous Page <span>|</span></a> ";
}
for($i = 1; $i <= $total_pages; $i++)
{
if ($page == $i)
{
echo " $i <span>|</span> ";
}
else
{
echo "<a href=\"OnlineExam.php?id=$id&page=$i\">$i <span>|</span></a> ";
}
}
if ($page < $total_pages)
{
$next = ($page + 1);
echo "<a href=\"OnlineExam.php?id=$id&page=$next\"> Next Page</a>";
}
?>
and this is my my answer choices..
<tr>
<?php echo "<td class='title'><Input type = 'Radio' Name =".$getexamquestion3['QuestionID']. "value= 'A'></td>"
?>
<?php echo "<td><strong>A. </strong>".$getexamquestion3['ExamAnswerA']."</td>";
?>
</tr>
<tr>
<?php echo "<td class='title'><Input type = 'Radio' Name =".$getexamquestion3['QuestionID']. "value= 'B'></td>"
?>
<?php echo "<td><strong>B. </strong>".$getexamquestion3['ExamAnswerB']."</td>";
?>
</tr>
<tr>
<?php echo "<td class='title'><Input type = 'Radio' Name =".$getexamquestion3['QuestionID']. "value= 'C'></td>"
?>
<?php echo "<td><strong>C. </strong>".$getexamquestion3['ExamAnswerC']."</td>";
?>
</tr>
<tr>
<?php echo "<td class='title'><Input type = 'Radio' Name =".$getexamquestion3['QuestionID']. "value= 'D'></td>"
?>
<?php echo "<td><strong>D. </strong>".$getexamquestion3['ExamAnswerD']."</td>";
?>
</tr>
My question is, how do i use sessions to hold all the inputted answers in the radio buttons so i can go back and forth through the pages and not have to re input the data.
Sorry for the long explanation, i thought it would be needed.
Really hope you can help me with this.
/Farril