if ($_POST['submit']) { $result = array(); $ttl = file_get_contents ('./q-data/t.txt'); $q1 = file_get_contents ('./q-data/1.txt'); $q2 = file_get_contents ('./q-data/2.txt'); file_put_contents ('./q-data/t.txt', ($ttl+1)); $grade = 0; if ($_POST['1'] == "All of the above.") { $grade += 50; file_put_contents ('./q-data/1.txt', ($q1+1)); $result[] = "Question 1: Correct!";} else { $result[] = "Question 1: INcorrect. The correct answer is \"All of the Above.\""; } if ($_POST['2'] == "What?") { $grade += 50; file_put_contents ('./q-data/2.txt', ($q2+1)); $result[] = "Question 2: Correct!"; } else { $result[] = "Question 2: INcorrect. The correct answer is \"What?\""; } $q1 = file_get_contents ('./q-data/1.txt'); $q2 = file_get_contents ('./q-data/2.txt'); $result[] = "Your score: $grade%"; $result[] = "Average score: ".number_format(((($q1+$q2)/2)/($ttl+1))*100,0)."%"; } ?>
=$v?>
}?>Thank you for taking our little quiz!