I am displaying questions with multiple choice answers.
So for instance:
How many sides on a triangle?
4
6
3
5
The answers are in form of radio buttons.
I want to be able to retrieve the question name (how many...) and answerName (4 6...)
Also I'm thinking for the form values, it would be beneficial to use the choice of answer where A would represent 4;
B = 6 and so on.
Can you please tell me whether there is an easier way to do this.
At the mo I have:
Code: Select all
<?php
$tblAnswers =$_GET['tblAnswers'];
$result = mysql_query("SELECT answerName, questionName, answer FROM tblAnswers WHERE answerID <=4");
if(!$result) die("Query Failed.");
if($result) {
echo '<table align="center"><tr></tr>';
while($row = mysql_fetch_array($result)) {
echo "<tr><td></td><td align=\"left\"><p><b> $row[1] </b></p><br></td></tr>
<tr><td></td><td><p> $row[0] </p></td></tr>";
}
echo '</table>';
}
?>
for the first question.
Is there a more simplified way though?