fixed bugs that prevented proper grading.

This commit is contained in:
Joshua Ashton
2025-02-14 05:08:06 -07:00
parent fcbe71e62b
commit 6f63a4afb8
30 changed files with 95 additions and 87 deletions
+2 -9
View File
@@ -37,10 +37,6 @@ $poll_options = [
'Visual Studio Code',
'XCode',
];
if (isset($_POST['option'])) {
setcookie('form_submitted', 'true', time() + 3600, '/'); // Expires in 1 hour (adjust as needed)
}
?>
<!doctype html>
@@ -55,7 +51,7 @@ if (isset($_POST['option'])) {
<body>
<h1>Poll</h1>
<?php
if (!isset($_POST['option']) && !isset($_COOKIE['form_submitted'])) {
if (!isset($_POST['option'])) {
echo '
<h3>What is the best text editor or IDE?</h3>
<form method="post">';
@@ -76,10 +72,7 @@ if (!isset($_POST['option']) && !isset($_COOKIE['form_submitted'])) {
</form>';
} else {
echo "<h3>Thank you! Here's the results.</h3>";
if ($_COOKIE['form_submitted'])
displayChart();
else
updateDb($_POST['option']);
updateDb($_POST['option']);
}
?>
</body>