ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/quiz/
Upload File :
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/quiz/mock-exam-backup-.php

<?php include "header.php";?>

<div class="container">
   <form class="multisteps_form position-relative overflow-hidden mt-5" id="wizard" method="POST">
      <!-- Form-header-content -->
      <div class="form_header_content text-center pt-4">
         <h2>QUIZ</h2>
         <span>Fill out this Tirnva quiz for fun!</span>
      </div>
      <!------------------------- Step-1 ----------------------------->
      
      <?php 
        
        
        $progress_percentage=0;
        $statement = $pdo->prepare("SELECT * FROM tbl_mock_test where exam_type='".$_GET['exam_id']."' and mock_test_type='".$_GET['test_id']."'");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$total=$statement->rowCount();
		$progress = 100/$total;
		$i=0;
		foreach ($result as $row) {
        $i++;
        $progress_percentage+=$progress;
        
        
      ?>
      
      
      
      <div class="multisteps_form_panel step">
         <!-- Form-content -->
         <span class="question_number text-uppercase mb-3 float-end">QUESTION <?=$i?>/<?=$total?></span>
         <div class="progress rounded-pill">
            <div class="progress-bar" role="progressbar" style="width: <?=$progress_percentage?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
         </div>
         <h1 class="question_title px-5 py-3 animate__animated animate__fadeInRight animate_25ms">
            <?=$row['question']?>
        </h1>
            <!-- Form-items -->
            <div class="form_items ps-5">
               <ul class="list-unstyled p-0">
                  <li class="active step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_50ms" id="answer_<?=$row['option_a']?>" onclick="ch('<?=$row['option_a']?>','<?=$row['id']?>');">
                     <input type="radio"  name="stp_1_select_option" value="<?=$row['option_a']?>" class="check">
                     <h6 style="display: contents;">A.</h6>
                     <label for="opt_1"><?=$row['option_a']?></label>
                     
                  </li>
                  <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_100ms" id="answer_<?=$row['option_b']?>" onclick="ch('<?=$row['option_b']?>','<?=$row['id']?>');">
                     <input type="radio" name="stp_1_select_option" value="<?=$row['option_b']?>" class="check">
                      <h6 style="display: contents;">B.</h6>
                     <label for="opt_2"><?=$row['option_b']?></label>
                  </li>
                  <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_150ms" id="answer_<?=$row['option_c']?>" onclick="ch('<?=$row['option_c']?>','<?=$row['id']?>');">
                     <input type="radio" name="stp_1_select_option" value="<?=$row['option_c']?>" class="check">
                      <h6 style="display: contents;">C.</h6>
                     <label for="opt_3"><?=$row['option_c']?></label>
                  </li>
                  <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_200ms" id="answer_<?=$row['option_d']?>" onclick="ch('<?=$row['option_d']?>','<?=$row['id']?>');">
                     <input type="radio"  name="stp_1_select_option" value="<?=$row['option_d']?>" class="check">
                      <h6 style="display: contents;">D.</h6>
                     <label for="opt_4"><?=$row['option_d']?></label>
                  </li>
               </ul>
                <p>
                  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
                    View Explanation
                  </button>
                </p>
                <div class="collapse" id="collapseExample" style="margin-left: -7%;">
                  <div class="card card-body">
                    <?=$row['explanation']?>
                  </div>
                </div>
            </div>
         </div>
         
         
         <?php } ?>
         
         
      </div>
   </form>
   <!---------- Form Button ---------->
   <div class="form_btn py-5 text-center">
      <button type="button" class="f_btn disable text-uppercase rounded-pill text-white" id="prevBtn" onclick="nextPrev(-1)"><span><i class="fas fa-arrow-left"></i></span> Last Question</button>
      <button type="button" class="f_btn active text-uppercase rounded-pill text-white" id="nextBtn" onclick="nextPrev(1)"> Next Question <i class="fas fa-arrow-right"></i></button>
   </div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.js"></script>-->
<script>
    function ch(answer,id){
            var user_id=1;
            console.log("User ID: "+user_id);
            console.log("Answer: "+answer);
            console.log("ID: "+id);
        $.ajax({
                    url: '../api/get-mock-result-api.php',
                    type: 'post',
                    dataType: 'json',
                    data: {type:'get_mock_question_res',answer:answer,user_id:user_id,id:id},
                    success: function (response) {
                        if(response['error']==false){
                            var m="";
                            for(var n=0;n<response['data'].length;n++){
                                        $('#answer_'+response['data'][n]['correct_answer']).css("background","yellow");
                                    }
                           
                        }else{
                            $('#answer_'+answer).css("background","red");
                        }
                        
                       
                    }
            });
    }

</script>

<?php include "footer.php";?>

Zerion Mini Shell 1.0