<div id='question<?php echo $i; ?>' class='cont'> <div class="question_css"> <h3><span class="label label-warning" id="qid"><?php echo $i; ?></span> <span class="questions" id="qname<?php echo $i; ?>"> <?php echo $value['question_entitle']; ?> </h3> </div> <ul class="quiz-ul"> <li class="quiz-li"> <input type="radio" value="<?php echo $options[0]['Options'];?>" id='radio1_<?php echo $options[0]['answer_proposal_id']; ?>' name='<?php echo $value['Questionid'];?>'/> <label for="radio1_<?php echo $options[0]['answer_proposal_id']; ?>" class="element-animation"><?php echo $options[0]['Options']; ?></label> <div class="check"></div> </li> <li class="quiz-li"> <input type="radio" value="<?php echo $options[1]['Options'];?>" id='radio2_<?php echo $options[1]['answer_proposal_id']; ?>' name='<?php echo $value['Questionid'];?>'/> <label for="radio1_<?php echo $options[1]['answer_proposal_id']; ?>" class="element-animation"><?php echo $options[1]['Options']; ?></label> <div class="check"></div> </li> <li class="quiz-li"> <input type="radio" value="<?php echo $options[2]['Options'];?>" id='radio3_<?php echo $options[2]['answer_proposal_id']; ?>' name='<?php echo $value['Questionid'];?>'/> <label for="radio1_<?php echo $options[2]['answer_proposal_id']; ?>" class="element-animation"><?php echo $options[2]['Options']; ?></label> <div class="check"></div> </li> <li class="quiz-li"> <input type="radio" value="<?php echo $options[3]['Options'];?>" id='radio4_<?php echo $options[3]['answer_proposal_id']; ?>' name='<?php echo $value['Questionid'];?>'/> <label for="radio1_<?php echo $options[3]['answer_proposal_id']; ?>" class="element-animation"><?php echo $options[3]['Options']; ?></label> <div class="check"></div> </li> <li class="quiz-li"> <input type="radio" checked='checked' style='display:none' value="5" id='radio5' name='<?php echo $value['Questionid'];?>'/> </li> </ul> <button id='<?php echo $i; ?>' class='next btn btn-success' type='button'>Suivant</button> </div>
if (isset($_POST['submit']) && !empty($_POST)) { $right_answer=0; $wrong_answer=0; $unanswered=0; $question_correct_answerid =$db->prepare ('SELECT Questionid, question_correct_answerid from question '); $question_correct_answerid->execute(); $correctAnswerId = $question_correct_answerid->fetchAll(); foreach ($correctAnswerId as $key => $row) { $correctOption= $db->prepare('SELECT Options,answer_proposal_id from answerproposal where is_Correct= 1 and answer_proposal_id = '.$row['question_correct_answerid'].' '); $correctOption->execute(); $correctOptions = $correctOption->fetchAll(); //var_dump($correctOptions); } foreach ($correctOptions as $key => $option) { if ($option['Options'] == $_POST[$value['Questionid']]) { $right_answer++; }else if($_POST[$value['Questionid']] == 5){ $unanswered++; }else{ $wrong_answer++; } } } ?> <div class="container result vh-center"> <div class="w100"> <hr> <div class="row dflex results-container"> <div class="results right"> <div> <p class="mtb-1">Total no. of right answers : <span class="answer"><?php echo $right_answer;?></span></p> <p class="mtb-1">Total no. of wrong answers : <span class="answer"><?php echo $wrong_answer;?></span></p> <p class="mtb-1">Total no. of Unanswered Questions : <span class="answer"><?php echo $unanswered; ?></span></p> </div> </div> </div> </div> </div>
value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)