how do I prevent form from checking at the current session?

enter image description here

enter image description here

The ones checked are the correct answer to the question. But when I click on the submit button, the questions changes and state the answers are wrong. I’ve tried too fix it by using the GET method. But that didn’t work either.

The result I am trying to get it have 3 random questions. Which are stored in an array with it’s options and answer. When the 3 questions are displayed, the options will be displayed with it. When the user clicks on the correct answer it should display the correct result, but it is not able to at the moment.

Let me include the code below.

    <?php
    /*-----------------------------------Generate 3 Random Questions ----------------------------------------- */
    /*Array Random Function*/
    $pickqns_key = array_rand($qnPool,3);
    //var_dump($pickqns_key); ----- Test if Array is sucessfully randomise with 3 questions

    /*Store 3 Question into an Array using the key generated*/
    $qns_3 = array();
    $i = 0;

    foreach($pickqns_key as $key){
        $qns_3[$i] = $qnPool[$key];
        $i++;
    }
    /*Individual Question List*/
    $question1 = $qns_3[0]["qns"];
        $q1option1 = $qns_3[0]["ops"][0];
        $q1option2 = $qns_3[0]["ops"][1];
        $q1option3 = $qns_3[0]["ops"][2];
            $q1ans = $qns_3[0]["ans"];
            var_dump($qns_3[0]);
            var_dump($q1ans);
    $question2 = $qns_3[1]["qns"];
        $q2option1 = $qns_3[1]["ops"][0];
        $q2option2 = $qns_3[1]["ops"][1];
        $q2option3 = $qns_3[1]["ops"][2];
            $q2ans = $qns_3[1]["ans"];
            var_dump($qns_3[1]);
            var_dump($q2ans);
    $question3 = $qns_3[2]["qns"];
        $q3option1 = $qns_3[2]["ops"][0];
        $q3option2 = $qns_3[2]["ops"][1];
        $q3option3 = $qns_3[2]["ops"][2];
            $q3ans = $qns_3[2]["ans"];
            var_dump($qns_3[2]);
            var_dump($q3ans);
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Final Exam</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1"><!--Please remember to change style sheet for each page-->
        <link rel= "stylesheet" href="styles/qn_History.css" type="text/css"/> 
    </head>
    <body>
        <header>
            <img class="logo" src ="source/images/nav_logo.png" alt="logo">
                <!------------Nav Bar-------------------->
                <nav>
                <ul class ="nav__links">
                  <li><a href="index.php">Home</a></li>
                  <li><a href="qn_History.php">History</a></li>
                  <li><a href="qn_Math.php">Mathematics</a></li>
                  <li><a href="#">Contact Us</a></li> <!--This contact us page is stated here just for show. If we have time we can create a simple form that doesn't work-->
                </ul>
                </nav>
        </header>
        
        <!-- This is where the main content for your webpages are going to be-->
        <div class ="quiz_box">
            <h2>History Questions - Answer Qn 1 - 3</h2>
            <div class="std_id">
                <?php
                    //$student_ID = $_GET['studentNum'];
                    //echo "<h3>Student No: $student_ID </h3>"; 
                ?>
            </div>
            <div class="history_qn">
                <form action="qn_History.php" method="POST">
<!------------------------------------History - Question 1 ------------------------------------------------------------->
                    <div class="qn">
                       <?php 
                            /*1st Trial at Printing Question and Radio Button*/
                            //$qn_counter = 1;
                            /*Printing out each Question from the Array*/
                            //foreach($qns_3 as $qns_No => $value){
                                //echo $qn_counter,". ",$value['qns'],"<br>";
                                /*Printing Out Radio Buttons of Options8*/
                                /*foreach($value['ops'] as $options){
                                    echo '<input type="radio" name= $qns_3 = $options>',$options,"<br>";
                                }
                                $qn_counter++;
                            }*/
                        ?>
                        <p>1. <?php echo $question1 ?><p></p>
                        <!--Option 1 -->
                        <input type ="radio" id ="q1o1" name = "qn1" value ="<?php echo $q1option1?>"/>
                        <label for ="q1o1"><?php echo $q1option1 ?></label><br>

                        <!--Option 2 -->
                        <input type ="radio" id ="q1o2" name = "qn1" value ="<?php echo $q1option2?>"/>
                        <label for ="q1o2"><?php echo $q1option2 ?></label><br>

                        <!--Option 3 -->
                        <input type ="radio" id ="q1o3" name = "qn1" value ="<?php echo $q1option3?>"/>
                        <label for ="q1o3"><?php echo $q1option3 ?></label><br>

                        <!-- Qn3 Action Handler-->
                        <div class = "action_handler">
                            <?php
                                $counter = 0;
                                if(isset($_POST['qn1'])){
                                    $ans1 = $_POST['qn1'];
                                    var_dump($ans1);
                                }
                                else{
                                    $ans1 = NULL;
                                }

                                if($ans1 != NULL){
                                    if($ans1 != $q1ans){
                                        echo "$ans1 is incorrect";

                                    }
                                    else{
                                        echo "$ans1 is correct";
                                        $counter += 1;                                        
                                    }
                                }
                                else{
                                    echo "Select an answer for Qn.1 <br>";
                                }
                            ?>
                        </div>
                    </div>
                    <br>

<!------------------------------------History - Question 2 ------------------------------------------------------------->
                    <div class="qn">
                        <p>2. <?php echo $question2 ?></p>
                        <!--Option 1 -->
                        <input type ="radio" id ="q2o1" name = "qn2" value ="<?php echo $q2option1?>"/>
                        <label for ="q2o1"><?php echo $q2option1 ?></label><br>

                        <!--Option 2 -->
                        <input type ="radio" id ="q2o2" name = "qn2" value ="<?php echo $q2option2?>"/>
                        <label for ="q2o2"><?php echo $q2option2 ?></label><br>

                        <!--Option 3 -->
                        <input type ="radio" id ="q2o3" name = "qn2" value ="<?php echo $q2option3?>"/>
                        <label for ="q2o3"><?php echo $q2option3 ?></label><br>
                        <div class="action_handler">
                            <?php
                                if(isset($_POST['qn2'])){
                                    $ans2 = $_POST['qn2'];
                                    var_dump($ans2);
                                }
                                else{
                                    $ans2 = NULL;
                                }
                            
                                if($ans2 != NULL){
                                    if($ans2 != $q2ans){
                                        echo "$ans2 is incorrect";
                                    }
                                    else{
                                        echo "$ans2 is correct";
                                        $counter += 1;
                                    }
                                }
                                else{
                                    echo "Select an answer for Qn.2 <br>";
                                }
                            ?>
                        </div>
                    </div>
                    <br>

<!------------------------------------History - Question 3 ------------------------------------------------------------->
                    <div class="qn">
                    <p>3. <?php echo $question3 ?></p>
                        <!--Option 1 -->
                        <input type ="radio" id ="q3o1" name = "qn3" value ="<?php echo $q3option1?>"/>
                        <label for ="q3o1"><?php echo $q3option1 ?></label><br>

                        <!--Option 2 -->
                        <input type ="radio" id ="q3o2" name = "qn3" value ="<?php echo $q3option2?>"/>
                        <label for ="q3o2"><?php echo $q3option2 ?></label><br>

                        <!--Option 3 -->
                        <input type ="radio" id ="q3o3" name = "qn3" value ="<?php echo$q3option3?>"/>
                        <label for ="q3o3"><?php echo $q3option3 ?></label><br>
                        <div class="action_handler">
                        <!-- Qn3 Action Handler-->
                            <?php
                                if(isset($_POST['qn3'])){
                                    $ans3 = $_POST['qn3'];
                                    var_dump($ans3);
                                }
                                else{
                                    $ans3 = NULL;
                                }
                            
                                if($ans3 != NULL){
                                    if($ans3 != $q3ans){
                                        echo "$ans3 is incorrect";
                                    }
                                    else{
                                        echo "$ans3 is correct";
                                        $counter += 1;
                                    }
                                }
                                else{
                                    echo "Select an answer for Qn.3 <br>";
                                }
                            ?>
                        </div>
                    </div>
                    <!--End of History Quiz -->
                    <br>
                        <input type="submit" name="submit" value="Submit Quiz" class ="btn"/>
                        <a href="resultpage.php" class="result-btn">View results</a>
                    </div>
                <div class ="results">
                    <?php
                        echo "<h3>Your score for this History Quiz is $counter / 3</h3>";
                    ?>
                </div>
                </form>
            </div>