Arithmetic Quiz

TOP; $number = $_SESSION["number"]; $answer = $_SESSION["answer"]; $correct = $_SESSION["correct"]; $question = $_SESSION["question"]; if ($number == 0) { print << You will be given $total_number questions in this quiz.

Here is your first question:

FIRST; } if ($number > 0) { if ($_POST["answer"] == $answer) { $correct++; $_SESSION["correct"] = $correct; print <<
CORRECT; } else { print <<
WRONG; } } if ($number >= $total_number) { print <<
Thank you for playing.

FINAL_SCORE; session_destroy(); } else { $number++; $_SESSION["number"] = $number; $x = rand(1, 100); $y = rand(1, 100); $question = $x . " + " . $y . " = "; $answer = $x + $y; $_SESSION["question"] = $question; $_SESSION["answer"] = $answer; $script = $_SERVER['PHP_SELF']; print <<
$question
FORM; } print << BOTTOM; ?>