<meta http-equiv="refresh" content="50;url=index.php"> </head> <body> <div class="triche"> <?php // on enregiste les réponses de l'utilisateur. $id_user = addUser(); // Boucle qui survole toutes les questions foreach ($questions as $id_question => $question) { $reponse = $_POST['question_' . $id_question]; // echo "Q".$id_question." : ".$reponse."\n"; // debug if ($reponse) { saveAnswer($id_question, $reponse, $id_user); } } // on obtient les réponses de l'utilisateur dans un tableau $query = "SELECT * from reponse where id_utilisateur=" . $id_user; $result = $db->query($query); $userAnswers = $db->getAssocArrays($result); // on affiche une page avec la correction $reponsesJustes = 0; $reponsesFausses = 0; $htmlOutput = ""; foreach ($questions as $id_question => $question) { // Boucle qui survole toutes les questions $htmlOutput .= " <div id=\"question_" . $id_question . "\" class=\"question\"> "; $htmlOutput .= " <h2> " . $question["libelle"] . " </h2> "; $idChoixReponse = $userAnswers[$id_question - 1]['valeur'];
<?php include '../config.php'; include '../functions.php'; saveAnswer($_POST['answer']);
<?php include_once 'task_management.php'; include_once 'nominal_label.php'; //Get answers $userID = getUserID(); $taskID = $_POST['documentID']; $labels = array(); foreach ($_POST as $key => $val) { if (strpos($key, 'attribute_') === 0) { $label = new NominalLabel(); $label->attributeID = intval(substr($key, 10)); $label->labelID = intval($val); $labels[] = $label; } } //Save results saveAnswer($taskID, $userID, $labels); if (isset($_REQUEST["crisisid"])) { header('Location: task_presenter.php?crisisid=' . $_REQUEST["crisisid"]); } else { header('Location: task_presenter.php'); }
<?php include_once 'task_management.php'; $taskID = intval($_REQUEST['id']); $userID = getUserID(); saveAnswer($taskID, $userID, null); if (isset($_REQUEST["crisisid"])) { header('Location: task_presenter.php?crisisid=' . $_REQUEST["crisisid"]); } else { header('Location: task_presenter.php'); }