I need a little extra help to figure out an issue I'm having. You can see a great deal of detail about it here: http://stackoverflow.com/questions/2134056/checking-correct-answer-and-submitting-form, but here's the basics.
- Project is a just-for-fun quiz composed of 10 question pages and 1 result page.
- Submitting a Form composed of 3 Radio buttons, 1 is correct.
- Security is not an issue.
- Cannot use JavaScript, all PHP/HTML/CSS (mobile browsers and limitations etc.)
- Form action takes the user to the next page.
How can I select the correct answer (can be hardcoded) and how can I save the number of right answers as a user continues through the pages?
<?php
/* Gets current correct answer Count */
$answer_count = $_GET["p"];
/* checks to see if the submitted answer is the same as the correct answer */
if ($_POST["submitted-answer"] == "correct-answer") {
$answer_count++;
}
?>
The form HTML:
<form name="quiz" action="" method="POST">
<label for="o1"><input type="radio" name="grp" id="o1" value="o1"> Label 1</label>
<label for="o2"><input type="radio" name="grp" id="o2" value="o2"> Label 2</label>
<label for="o3"><input type="radio" name="grp" id="o3" value="o3"> Label 3</label>
<input type="submit" value="Next Question" class="btn">
</form>
The values of my radio buttons are not necessary at the moment. Can I use something utilizing value="wrong" on the two wrong answers and value="right" on the correct one?