Some problems with my 'Random' Quiz...

Hi. Today I’m coding at a special Quiz. It consist to print 10 random questions and for each question print 4 (no random) answers with a radio input in the side.

The function to print random question is OK but… How can I do an automated quiz checker?

This is the function:
[php]function onRandomQuestionQuiz()
{
$tot_question = 75;
switch(rand(1, $tot_question))
{
case 1:
{
$question = “What is Role Play?”;
$answerA = “It’s a Role Game”;
$answerB = “It’s a Team Game”;
$answerC = “It’s a Roll Game”;
$answerD = “I’ve no idea!”;
$answer = “A”; //This is the correct answer
}
// there are 75 cases with the question and the answers
}
return array ($question, $answerA, $answerB, $answerC, $answerD, $answer);[/php]

This is the quiz:
[php]echo "

Passo 3/4 - Quiz per valutare la tua esperienza roleplay.

";
echo “
”;
echo “<form action=’?p=index&sub=register&step=checkquiz’ method=‘post’”;
list ($question, $answerA, $answerB, $answerC, $answerD, $answer) = onRandomQuestionQuiz();
echo “”.$question."";
echo “”.$answerA;
echo “”.$answerB;
echo “”.$answerC;
echo “”.$answerD; echo “
”;
//There are 10 Questions with the answers
echo “
”;
echo “”;[/php]

Thanks for your useful support!

Sponsor our Newsletter | Privacy Policy | Terms of Service