I am admittedly not as skilled in PHP as I would hope to be. Most of my experience is with Wordpress loops.
I'm trying to create a very simple quiz that carries the number of correct answers in the URL (eg. domaindotcom/?p=3 if they've got 3 correct answers so far).
I'm using the following PHP code to start it off:
<?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++;
}
?>
Now I know I can get the correct link by using the link:
<a href="link-to-next-question.php/?p=<?php echo $answer_count; ?>">Next Question</a>
But now I'm trying to use it in a form and confused by POST, GET, etc.
Here's my 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>
How can I choose the correct answer (security not important, it's just a fun quiz) and then send them along to the next URL while adding the increment to the $answer_count before the URL is created?