I have a quiz program, it is working but it shows the options of the questions in the same order ie currently the correct answer of each of the question will be displayed as the last option only. Is there anyway to display the options randomly?. Am a newbie; This is my first post here and your suggestions are sincerely appreciated. Here is my code which shows the questions and answers from the DB.
mysql_select_db("quiz_k");
$exam="SELECT * FROM php";
$result=mysql_query($exam);
for($i=1;$i<=20;$i++)
{
while($row=mysql_fetch_assoc($result))
{
echo $row['id'].")";
$x=$row['id'];
echo $row['question']."<br>";
?>
<input type="radio" required='required' name="<?php echo $row['id'] ?>" value="<?php echo $row['option1'] ?>">
<?php
echo $row['option1'].'<br>';
?>
<input type="radio" required='required' name="<?php echo $row['id'] ?>" value="<?php echo $row['option2'] ?>">
<?php
echo $row['option2'].'<br>';
?>
<input type="radio" required='required' name="<?php echo $row['id'] ?>" value="<?php echo $row['option3'] ?>">
<?php
echo $row['option3'].'<br>';
?>
<input type="radio" required='required' name="<?php echo $row['id'] ?>" value="<?php echo $row['answer'] ?>">
<?php
echo $row['answer'].'<br>';
}
}
?>
<br>
<input type="submit" name="submit" value="submit" >
</form>
</html>