<div class="panel-body"> <div class="page-header " style = "margin-top:5px; "> <h2>Please Input your name</h2> </div> <form action="" method="post"> Name: <input type="text" name="name"><br> <input type="submit"> </form> </div> </div> </div> </div> <?php if (isset($_POST['name'])) { if (!empty($_POST['name'])) { record_quiz_results($quiz_id, $_POST['name'], $percent); unset($_SESSION['startQuiz']); unset($_SESSION['last_id']); unset($_SESSION['quiz_tally_array']); $_SESSION['startQuiz'] = 0; header("Location: " . $_SESSION['exiting'] . "?msg={$percent}"); } else { print "Please, input something."; } } } ///check if user was correct or incorrect ?> </body> </html> <?php
$numCorrect++; } } $percent = $numCorrect / $count * 100; $percent = intval($percent); if (isset($_POST['complete']) && $_POST['complete'] == "true") { if (!isset($_POST['username']) || $_POST['username'] == "") { echo "Sorry, We had an error"; exit; } $username = $_POST['username']; $username = sanitize($username); $username = strip_tags($username); if (!in_array("1", $_SESSION['answer_array'])) { record_quiz_results($username, '0'); /* $sql = mysql_query("INSERT INTO quiz_takers (username, percentage, date_time) VALUES ('$username', '0', now())")or die(mysql_error()); */ echo "Did you even read the questions? You scored {$percent}%, You must be retarded."; unset($_SESSION['answer_array']); unset($_SESSION['qid_array']); exit; } record_quiz_results($username, $percent); /* $sql = mysql_query("INSERT INTO quiz_takers (username, percentage, date_time) VALUES ('$username', '$percent', now())")or die(mysql_error()); */ echo "Thanks for taking the quiz! You scored {$percent}%"; unset($_SESSION['answer_array']); unset($_SESSION['qid_array']); exit; } }