Hi all,
I have a table in my mysql database which is made up of: id(primary), questiontext (varchar), section (Int), and answercount (Int).
My html form needs to select and display the question on screen but more importantly for each question it displays, it needs to echo a Radio Option depending on what number is stored in answercount. (i.e. if answercount = 5, then i need 5 radio options)
I will obvisouly be using these radio options to store answers when I post my page so if anyone can look at my code which is currently displaying the question and insert/amend the code which will dynamically display the radio options I would be very grateful.
The radio options will need to go where the ' ' is currently displayed.
<?php
$sqlquery = "SELECT id, section, questiontext, anwsercount
FROM tblquestions WHERE section = 4";
$result = mysql_query($sqlquery);
while ($datarow = mysql_fetch_array($result)) {
$id = $datarow['id'];
$section = $datarow['section'];
$answercount = $datarow['answercount'];
$questiontext = $datarow['questiontext'];
echo " <tr>
<td class=\"questioncol\"><p>$questiontext</p></td>
<td class=\"gradecol\"> </td>
<td class=\"gradecol\"> </td>
<td class=\"gradecol\"> </td>
<td class=\"gradecol\"> </td>
<td class=\"gradecol\"> </td>
</tr>";
}
mysql_free_result($result);
?>
Many thanks in advance
K.