Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action= "Graded.php" method="post" id="quiz">
- <div class="required">
- <label>Name:</label>
- <input type="text" required>
- </div>
- <style>
- .required:after { content:" required*"; }
- </style>
- <br>
- <div class="required">
- <label>Email:</label>
- <input type="text" required>
- </div>
- <style>
- .required:after { content:" required*"; }
- </style>
- <br>
- <br>
- <li>
- Question 1: The Chinese zodiac associates a sign with each month.
- <div>
- <input type="radio" name="question-1-answers" id="question-1-answers-A" value="A" required />
- <label for="question-1-answers-A">True </label>
- <div>
- <input type="radio" name="question-1-answers" id="question-1-answers-B" value="B" required />
- <label for="question-1-answers-B">False </label>
- <div>
- </li>
- <li>
- Question 2: Chinese zodiac signs represent different types of personalities.
- <div>
- <input type="radio" name="question-2-answers" id="question-2-answers-A" value="A" required/>
- <label for="question-2-answers-A">True </label>
- <div>
- <input type="radio" name="question-2-answers" id="question-2-answers-B" value="B" required/>
- <label for="question-2-answers-B">False </label>
- <div>
- </li>
- <li>
- Question 3: The Chinese zodiac signs each have an equivalent constellations, like those of the occidental zodiac.
- <div>
- <input type="radio" name="question-3-answers" id="question-3-answers-A" value="A" required />
- <label for="question-3-answers-A">True </label>
- <div>
- <input type="radio" name="question-3-answers" id="question-3-answers-B" value="B" required />
- <label for="question-3-answers-B">False </label>
- <div>
- </li>
- <li>
- Question 4: Which sign is not part of the Chinese zodiac?
- <div>
- <input type="radio" name="question-4-answers" id="question-4-answers-A" value="A" required />
- <label for="question-4-answers-A">A) Rat </label>
- </div>
- <div>
- <input type="radio" name="question-4-answers" id="question-4-answers-B" value="B" required/>
- <label for="question-4-answers-B">B) Fox </label>
- </div>
- <div>
- <input type="radio" name="question-4-answers" id="question-4-answers-C" value="C" required />
- <label for="question-4-answers-C">C) Pig</label>
- </div>
- <div>
- <input type="radio" name="question-4-answers" id="question-4-answers-D" value="D" required/>
- <label for="question-4-answers-D">D) Tiger</label>
- </div>
- </li>
- <li>
- Question 5: The Chinese zodiac traditionally begins with which sign?
- <div>
- <input type="radio" name="question-5-answers" id="question-5-answers-A" value="A" required />
- <label for="question-5-answers-A">A) Rat </label>
- </div>
- <div>
- <input type="radio" name="question-5-answers" id="question-5-answers-B" value="B" required />
- <label for="question-5-answers-B">B) Fox </label>
- </div>
- <div>
- <input type="radio" name="question-5-answers" id="question-5-answers-C" value="C" required />
- <label for="question-5-answers-C">C) Pig</label>
- </div>
- <div>
- <input type="radio" name="question-5-answers" id="question-5-answers-D" value="D" required />
- <label for="question-5-answers-D">D) Tiger</label>
- </div>
- </li>
- <li>
- Question 6: The Chinese zodiac traditionally ends with which sign?
- <div>
- <input type="radio" name="question-6-answers" id="question-6-answers-A" value="A" required />
- <label for="question-6-answers-A">A) Rat </label>
- </div>
- <div>
- <input type="radio" name="question-6-answers" id="question-6-answers-B" value="B" required />
- <label for="question-6-answers-B">B) Fox </label>
- </div>
- <div>
- <input type="radio" name="question-6-answers" id="question-6-answers-C" value="C" required />
- <label for="question-6-answers-C">C) Pig</label>
- </div>
- <div>
- <input type="radio" name="question-6-answers" id="question-6-answers-D" value="D" required />
- <label for="question-6-answers-D">D) Tiger</label>
- </li>
- </div>
- <li>
- Question 7: How many signs are in the Chinese zodiac? <input type="text" name="question-7-answers" value="" required>
- <div>
- Question 8: Which is the only reptile that is a sign in the Chinese zodiac? <input type="text" name="question-8-answers" value="" required>
- <div>
- Question 9: Which is the only imaginary animal that is a sign in the Chinese zodiac? <input type="text" name="question-9-answers" value="" required>
- <div>
- Question 10: Which is the only bird that is a sign in the Chinese zodiac? <input type="text" name="question-10-answers" value="" required>
- <div>
- </li>
- <div>
- <input type="submit" value="Submit Quiz" />
- <input type="reset" value="Reset Quiz" class = "reset_button" />
- </form>
- <?php
- $answer1 = $_POST['question-1-answers'];
- $answer2 = $_POST['question-2-answers'];
- $answer3 = $_POST['question-3-answers'];
- $answer4 = $_POST['question-4-answers'];
- $answer5 = $_POST['question-5-answers'];
- $answer6 = $_POST['question-6-answers'];
- $answer7 = $_POST['question-7-answers'];
- $answer8 = $_POST['question-8-answers'];
- $answer9 = $_POST['question-9-answers'];
- $answer10 = $_POST['question-10-answers'];
- $answer7 = strtolower(trim($answer7));
- $answer8 = strtolower(trim($answer8));
- $answer9 = strtolower(trim($answer9));
- $answer10 = strtolower(trim($answer10));
- $totalCorrect = 0;
- if ($answer1 == "B") { $totalCorrect++; echo "Question 1 was Correct: The Chinese zodiac associates a sign with each month. Answer: False <br />n"; }
- else echo "Question 2 was incorrect. This is the correct answer: The Chinese zodiac associates a sign with each month. Answer: False <br />n";
- if ($answer2 == "A") { $totalCorrect++; echo "Question 2 was Correct: Chinese zodiac signs represent different types of personalities. Answer: Ture <br />n"; }
- else echo "Question 2 was incorrect. This is the correct answer: Chinese zodiac signs represent different types of personalities. Answer: True <br />n";
- if ($answer3 == "B") { $totalCorrect++; echo "Question 3 was Correct: The Chinese zodiac signs each have an equivalent constellations, like those of the occidental zodiac. Answer: False <br />n";}
- else echo"Question 3 was incorrect. This is the correct answer: Question 3: The Chinese zodiac signs each have an equivalent constellations, like those of the occidental zodiac. Answer: False <br />n";
- if ($answer4 == "B") { $totalCorrect++; echo "Question 4 was Correct: Which sign is not part of the Chinese zodiac? Answer: Fox <br />n";}
- else echo "Question 4 was incorrect. This is the correct answer: Which sign is not part of the Chinese zodiac? Answer: Fox <br />n";
- if ($answer5 == "A") { $totalCorrect++; echo "Question 5 was Correct: The Chinese zodiac traditionally begins with which sign? Answer: Rat<br />n";}
- else echo"Question 5 was incorrect. This is the correct answer: The Chinese zodiac traditionally begins with which sign? Answer: Rat <br />n";
- if ($answer6 == "C") { $totalCorrect++; echo "Question 6 was Correct: The Chinese zodiac traditionally ends with which sign? Answer: Pig <br />n";}
- else echo"Question 6 was incorrect. This is the correct answer: The Chinese zodiac traditionally ends with which sign? Answer: Pig <br />n";
- if ($answer7 == "12" || $answer7 == "twelve") { $totalCorrect++; echo "Question 7 was Correct: How many signs are in the Chinese zodiac? Answer: 12 <br />n";}
- else echo"Question 7 was incorrect. This is the correct answer: How many signs are in the Chinese zodiac? Answer: 12 <br />n";
- if ($answer8 == "Snake" || $answer8 == "snake") { $totalCorrect++; echo "Question 8 was Correct: Which is the only reptile that is a sign in the Chinese zodiac? Answer: Snake <br />n";}
- else echo "Question 8 was incorrect. This is the correct answer: Which is the only reptile that is a sign in the Chinese zodiac? Answer: Snake <br />n";
- if ($answer9 == "Dragon" || $answer9 == "dragon") { $totalCorrect++; echo "Question 9 was Correct: Which is the only imaginary animal that is a sign in the Chinese zodiac? Answer: Dragon <br />n";}
- else echo "Question 9 was incorrect. This is the correct answer: Which is the only imaginary animal that is a sign in the Chinese zodiac? Answer: Dragon <br />n";
- if ($answer10 == "Rooster" || $answer10 == "rooster") { $totalCorrect++; echo "Question 10 was Correct: Which is the only bird that is a sign in the Chinese zodiac? Answer: Rooster <br />n";}
- else echo "Question 10 was incorrect. This is the correct answer: Which is the only bird that is a sign in the Chinese zodiac? Answer: Rooster <br />n";
- echo "<div id='results'>$totalCorrect / 10 correct</div>";
- $percent = $totalCorrect;
- echo "You got a ", "$percent", "0%";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement