I'm doing a quiz page and there will be only one question and a text box with a submit button. If the user answer it correct, it should send the user to another page call answer page and tell the user is correct. I have gotten that working but the question I have is that is how do I keep each previous answer that is answer correctly from the quiz page and display it back to the user when the user is in the answer page. If anyone is wondering why mine is straight up php and why not HTML, I was required to put HTML as PHP instead, so please don't mind.
Here is my answer page
$count = 0; userAnswer = $_POST['userAnswer']; $sessionAnswer = $_SESSION['answer']; if (isset($submit)) { if($userAnswer == $sessionAnswer) { print $_SESSION['correct'] = "Your answer is correct"; $count++; print "<br>"; print $count; print "<br>"; print "<a class='nav-link quizNav' href='quiz.php'>Get Another Question</a>"; } }
https://stackoverflow.com/questions/67362166/how-to-keep-adding-variable-each-time-a-post-is-send-to-another-page-in-php May 03, 2021 at 08:07AM
没有评论:
发表评论