public function display( )
{

$query="SELECT * FROM test  ORDER BY RAND() limit 5  ";
$result=mysql_query($query)or die("cannot select DB");
$num=mysql_numrows($result);
echo "<table>";
echo "<tr>"."<td style='overfolw-hidden;width:400px;'> Question: </td>";
echo "<td style='overfolw-hidden;width:40px;'> OPTION A </td>";
echo "<td style='overfolw-hidden;width:40px;'> OPTION B </td>";
echo "<td style='overfolw-hidden;width:40px;'> OPTION C </td>";
echo "<td style='overfolw-hidden;width:40px;'> OPTION D </td>";
echo "</tr>";

while($row = mysql_fetch_array($result))
  {
echo"<tr>";
echo "<td>" . $row['question'] . "</td>";
echo "<td>$row[a]<input type='radio' name='opt' value='$row[a]'> </td>";
echo "<td>$row[b]<input type='radio' name='opt' value='$row[b]'> </td>";
echo "<td>$row[c]<input type='radio' name='opt' value='$row[c]'> </td>";
echo "<td>$row[d]<input type='radio' name='opt' value='$row[d]'> </td>";
echo"</tr>";
}

echo"</table> <br/>";

}

Quoted Text Here

here 5 questions with their respective answers can be visible.but we have to choose one radio button for 1 question.but it can allowing to choose only 1 radio button for all questions. wat can i do now

please help me as soon as possible

If you have a $row['id'] you can postfix that to the name of the radiobutton. If not, just use a counter which increases every iteration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.