/** * Created by PhpStorm. * User: JayDz * Date: 15/07/15 * Time: 2:54 PM */ require_once './controller/QuestionCtrl.php'; $uid = $_COOKIE['uid']; //echo $uid; $b = false; if (isset($_POST['c']) && $_POST['c'] != '') { $c = $_POST['c']; $answers = new Answers($uid, $c); foreach ($_POST as $key => $value) { $param_name = 'ans::'; if (substr($key, 0, strlen($param_name)) == $param_name) { $ques = explode('ans::', $key)[1]; $ans = explode('_', $value)[1]; $ktext = explode('_', $value)[2]; $answers->addAns(new Answer($ques, $ans . '_' . $ktext)); $b = true; } } } if ($b) { QuestionCtrl::submitTest($answers); echo 'okkkk'; } else { echo '<script>window.location.href="index.php"</script>'; }
<?php /** * Created by PhpStorm. * User: JayDz * Date: 10/07/15 * Time: 12:02 AM */ require_once './controller/QuestionCtrl.php'; require_once './controller/UserCtrl.php'; if (!UserCtrl::isDone(2)) { $uid = $_COOKIE['uid']; QuestionCtrl::submitTest(new Answers($uid, 3)); } ?> <div class="clear-top hidden-xs"></div> <div class="container"> <div class="jumbotron"> <h2>Congrats!</h2> <p>Let's do some questions to see how better you are now xD.</p> <p><a class="btn btn-primary btn-lg" href="index.php?p=1&c=2" role="button"> <span class="glyphicon glyphicon-chevron-right"></span> Do post-test</a></p> </div> </div>