I am trying to create an all-in-one form PHP quiz. So far I have this for the form:
<head>
<title>Zodiac Quiz</title>
</head>
<body>
<h1>Chinese Zodiac Quiz!</h1>
<form name="ZodiacQuiz" action="ZodiacQuiz.php" method="get">
<p>1. How many Zodiac Signs are there?</p><input type="radio" name="quest_one" value="13"> 13
<input type="radio" name="quest_one" value="16"> 16
<input type="radio" name="quest_one" value="12">12
<input type="radio" name="quest_one" value="14">14<br/>
<p>2. 1989 is the year of the Snake:</p> <input type="radio" name="quest_two" value="True">True
<input type="radio" name="quest_two" value="False">False<br/>
<p>3. The year of the monkey started in: <input type="text" name="quest_three" value="" /></p><br/>
<p>4. The Cat is in the Chinese Zodiac:</p> <input type="radio" name="quest_four" value="True">True
<input type="radio" name="quest_four" value="False">False<br/>
<p>5. 2010 is the year of the: <input type="text" name="quest_five" value="" /></p><br/>
<p>Please enter your name and e-mail for they are required:</p>
<p>Name <input type="text" name="name" /> Email <input type="text" name="email" /></p>
<input type="submit" value="Submit Quiz"> <input type="reset" value="Reset Quiz">
</form>
That is my form, which I hope I did right and here is what I am working with to try and get the first question to work
Code: Select all
$score = 0;
$mod = $score % 5;
if (isset($_REQUEST['quest_one']))
{
$quest_one = $_REQUEST['quest_one'];
if($quest_one == 12)
{
echo "<p>Correct</p>";
$score++;
}
else
{
echo "<p>Incorrect. The real answer is 12.</p>";
}