Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.45 KB | None | 0 0
  1. <form action= "Graded.php" method="post" id="quiz">
  2.  
  3. <div class="required">
  4. <label>Name:</label>
  5. <input type="text" required>
  6.  
  7. </div>
  8.  
  9. <style>
  10. .required:after { content:" required*"; }
  11. </style>
  12. <br>
  13.  
  14. <div class="required">
  15. <label>Email:</label>
  16. <input type="text" required>
  17.  
  18. </div>
  19.  
  20. <style>
  21. .required:after { content:" required*"; }
  22. </style>
  23. <br>
  24. <br>
  25.  
  26.  
  27.  
  28. <li>
  29. Question 1: The Chinese zodiac associates a sign with each month.
  30. <div>
  31. <input type="radio" name="question-1-answers" id="question-1-answers-A" value="A" required />
  32. <label for="question-1-answers-A">True </label>
  33. <div>
  34. <input type="radio" name="question-1-answers" id="question-1-answers-B" value="B" required />
  35. <label for="question-1-answers-B">False </label>
  36. <div>
  37. </li>
  38.  
  39. <li>
  40. Question 2: Chinese zodiac signs represent different types of personalities.
  41. <div>
  42. <input type="radio" name="question-2-answers" id="question-2-answers-A" value="A" required/>
  43. <label for="question-2-answers-A">True </label>
  44. <div>
  45. <input type="radio" name="question-2-answers" id="question-2-answers-B" value="B" required/>
  46. <label for="question-2-answers-B">False </label>
  47. <div>
  48. </li>
  49.  
  50. <li>
  51. Question 3: The Chinese zodiac signs each have an equivalent constellations, like those of the occidental zodiac.
  52. <div>
  53. <input type="radio" name="question-3-answers" id="question-3-answers-A" value="A" required />
  54. <label for="question-3-answers-A">True </label>
  55. <div>
  56. <input type="radio" name="question-3-answers" id="question-3-answers-B" value="B" required />
  57. <label for="question-3-answers-B">False </label>
  58. <div>
  59. </li>
  60.  
  61. <li>
  62.  
  63. Question 4: Which sign is not part of the Chinese zodiac?
  64.  
  65. <div>
  66. <input type="radio" name="question-4-answers" id="question-4-answers-A" value="A" required />
  67. <label for="question-4-answers-A">A) Rat </label>
  68. </div>
  69.  
  70. <div>
  71. <input type="radio" name="question-4-answers" id="question-4-answers-B" value="B" required/>
  72. <label for="question-4-answers-B">B) Fox </label>
  73. </div>
  74.  
  75. <div>
  76. <input type="radio" name="question-4-answers" id="question-4-answers-C" value="C" required />
  77. <label for="question-4-answers-C">C) Pig</label>
  78. </div>
  79.  
  80. <div>
  81. <input type="radio" name="question-4-answers" id="question-4-answers-D" value="D" required/>
  82. <label for="question-4-answers-D">D) Tiger</label>
  83. </div>
  84.  
  85. </li>
  86.  
  87. <li>
  88. Question 5: The Chinese zodiac traditionally begins with which sign?
  89.  
  90. <div>
  91. <input type="radio" name="question-5-answers" id="question-5-answers-A" value="A" required />
  92. <label for="question-5-answers-A">A) Rat </label>
  93. </div>
  94.  
  95. <div>
  96. <input type="radio" name="question-5-answers" id="question-5-answers-B" value="B" required />
  97. <label for="question-5-answers-B">B) Fox </label>
  98. </div>
  99.  
  100. <div>
  101. <input type="radio" name="question-5-answers" id="question-5-answers-C" value="C" required />
  102. <label for="question-5-answers-C">C) Pig</label>
  103. </div>
  104.  
  105. <div>
  106. <input type="radio" name="question-5-answers" id="question-5-answers-D" value="D" required />
  107. <label for="question-5-answers-D">D) Tiger</label>
  108. </div>
  109. </li>
  110.  
  111. <li>
  112. Question 6: The Chinese zodiac traditionally ends with which sign?
  113.  
  114. <div>
  115. <input type="radio" name="question-6-answers" id="question-6-answers-A" value="A" required />
  116. <label for="question-6-answers-A">A) Rat </label>
  117. </div>
  118.  
  119. <div>
  120. <input type="radio" name="question-6-answers" id="question-6-answers-B" value="B" required />
  121. <label for="question-6-answers-B">B) Fox </label>
  122. </div>
  123.  
  124. <div>
  125. <input type="radio" name="question-6-answers" id="question-6-answers-C" value="C" required />
  126. <label for="question-6-answers-C">C) Pig</label>
  127. </div>
  128.  
  129. <div>
  130. <input type="radio" name="question-6-answers" id="question-6-answers-D" value="D" required />
  131. <label for="question-6-answers-D">D) Tiger</label>
  132. </li>
  133. </div>
  134. <li>
  135. Question 7: How many signs are in the Chinese zodiac? <input type="text" name="question-7-answers" value="" required>
  136. <div>
  137. Question 8: Which is the only reptile that is a sign in the Chinese zodiac? <input type="text" name="question-8-answers" value="" required>
  138. <div>
  139. 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>
  140. <div>
  141. Question 10: Which is the only bird that is a sign in the Chinese zodiac? <input type="text" name="question-10-answers" value="" required>
  142. <div>
  143. </li>
  144. <div>
  145. <input type="submit" value="Submit Quiz" />
  146. <input type="reset" value="Reset Quiz" class = "reset_button" />
  147. </form>
  148.  
  149. <?php
  150.  
  151.  
  152.  
  153.  
  154.  
  155. $answer1 = $_POST['question-1-answers'];
  156. $answer2 = $_POST['question-2-answers'];
  157. $answer3 = $_POST['question-3-answers'];
  158. $answer4 = $_POST['question-4-answers'];
  159. $answer5 = $_POST['question-5-answers'];
  160. $answer6 = $_POST['question-6-answers'];
  161. $answer7 = $_POST['question-7-answers'];
  162. $answer8 = $_POST['question-8-answers'];
  163. $answer9 = $_POST['question-9-answers'];
  164. $answer10 = $_POST['question-10-answers'];
  165. $answer7 = strtolower(trim($answer7));
  166. $answer8 = strtolower(trim($answer8));
  167. $answer9 = strtolower(trim($answer9));
  168. $answer10 = strtolower(trim($answer10));
  169. $totalCorrect = 0;
  170.  
  171. if ($answer1 == "B") { $totalCorrect++; echo "Question 1 was Correct: The Chinese zodiac associates a sign with each month. Answer: False <br />n"; }
  172. else echo "Question 2 was incorrect. This is the correct answer: The Chinese zodiac associates a sign with each month. Answer: False <br />n";
  173.  
  174. if ($answer2 == "A") { $totalCorrect++; echo "Question 2 was Correct: Chinese zodiac signs represent different types of personalities. Answer: Ture <br />n"; }
  175. else echo "Question 2 was incorrect. This is the correct answer: Chinese zodiac signs represent different types of personalities. Answer: True <br />n";
  176.  
  177. 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";}
  178. 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";
  179.  
  180. if ($answer4 == "B") { $totalCorrect++; echo "Question 4 was Correct: Which sign is not part of the Chinese zodiac? Answer: Fox <br />n";}
  181. else echo "Question 4 was incorrect. This is the correct answer: Which sign is not part of the Chinese zodiac? Answer: Fox <br />n";
  182.  
  183. if ($answer5 == "A") { $totalCorrect++; echo "Question 5 was Correct: The Chinese zodiac traditionally begins with which sign? Answer: Rat<br />n";}
  184. else echo"Question 5 was incorrect. This is the correct answer: The Chinese zodiac traditionally begins with which sign? Answer: Rat <br />n";
  185.  
  186. if ($answer6 == "C") { $totalCorrect++; echo "Question 6 was Correct: The Chinese zodiac traditionally ends with which sign? Answer: Pig <br />n";}
  187. else echo"Question 6 was incorrect. This is the correct answer: The Chinese zodiac traditionally ends with which sign? Answer: Pig <br />n";
  188.  
  189. if ($answer7 == "12" || $answer7 == "twelve") { $totalCorrect++; echo "Question 7 was Correct: How many signs are in the Chinese zodiac? Answer: 12 <br />n";}
  190. else echo"Question 7 was incorrect. This is the correct answer: How many signs are in the Chinese zodiac? Answer: 12 <br />n";
  191.  
  192. 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";}
  193. 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";
  194.  
  195. 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";}
  196. 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";
  197.  
  198. 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";}
  199. 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";
  200.  
  201. echo "<div id='results'>$totalCorrect / 10 correct</div>";
  202. $percent = $totalCorrect;
  203. echo "You got a ", "$percent", "0%";
  204. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement