<html><body>
<?
if ($_POST['submit']){
$ans=0;
echo ("<p>Your answers: ");
echo ("<p>There are ".$_POST['choice1']." days in a week.</p>");
echo ("<p>".$_POST['choice2']." is the first day of the week.</p>");
if($_POST['choice1']=="7"){
$ans=$ans+1;
echo ("<p>Your answer is correct! There are ".$_POST['choice1']." days in a week.</p>");
}else{
echo ("<p>Your answer is incorrect! There are not ".$_POST['choice1']." days in a week.</p>");
}
if($_POST['choice2']=="sunday"){
$ans=$ans+1;
echo ("<p>Your answer is correct! ".$_POST['choice2']." is the fist day of the week.</p>");
}else{
echo ("<p>Your answer is incorrect! ".$_POST['choice2']." is not the fist day of the week.</p>");
}
$score = $ans;
echo ("<p><b><i>Your score is $score.</b></i></p>");
}
else{
?>
<form action="<? echo $PHP_SELF; ?>" method="post">
How many days in a week ?:
<input type="radio" name="choice1" value="5" checked>5
<input type="radio" name="choice1" value="6">6
<input type="radio" name="choice1" value="7">7
<br>
What is the first day of the week?:
<input type="radio" name="choice2" value="monday" checked>monday
<input type="radio" name="choice2" value="sunday">sunday
<input type="radio" name="choice2" value="saturday">saturday
<P>
<input type="submit" name="submit" value="submit">
</form>
<?
}
?>
</body></html>