Multiple Choices

i am inserting question in database for multiple choices question

the table in database contains
id, question, right answer, choice 1, choice 2, choice 3

Example:
Question: What is the capital of England?
Right answer: London
Choice 1: Paris
Choice 2: Amesterdam
Choice 3: New York

all that i need is to view the fileds of right answer, choice 1, choice 2, choice 3 in random view so that when refreshing the page the order of multiple choice will change randomly

Example:
Please choose the correct answer
What is the capital of England?
(1- Paris, 2- London , 3- New York, 4- Amesterdam)

After Refresjing the page
the choice will change randomly

(1- London , 2- Paris , 3-Amesterdam , 4- New York)

etc…

Use ORDER BY RAND() in your sql query…:shifty:

Heres on pseudo-codish way of doing it:

$data = mysql gets row about a question

$answers = put each answer into an array in php

Then just [fphp]shuffle/fphp your $answers.


$answers[] = 'London' ;
$answers[] = 'Paris' ;
$answers[] = 'New York' ;
shuffle( $answers);
$ctr = 1 ;
foreach(  $answers as $a ){
echo <input type=radio value='$a' name='question1'>$ctr $a  <br />;
$ctr++ ;
}

The question number is irrelevant as you are going to have to check the returned radio button value against the text ‘right answer’ value in your database.