title: Comparing arrays to calculate the grade
body: <p>My student.php page: Displayin questions with their multiple choices randomly from database</p>
  
  <pre><code> &lt;form name="f1" id=f1 method="get" action="submittingquiz.php"&gt;
          &lt;?php
          $correct=array();
  
        $query=  mysql_query("select 
       question_number,question_description,correctanswer_id from 
       quizzesbankofquestion where course_code='MATH220' &amp;&amp; quiz_level='1' &amp;&amp; 
       level_of_difficulty='1' ORDER BY RAND() LIMIT 3");
       if (!$query) die ("Database access failed: " . mysql_error());
         $row=  mysql_num_rows($query); 
        if($row!=0){
  
        while($questions=  mysql_fetch_array($query)){
            $correct=array($questions[2]);
            $_SESSION['array']=$correct;
          echo "&lt;table&gt;
           &lt;tr&gt;&lt;td&gt; $questions[0]&lt;/td&gt;
                    &lt;td&gt;$questions[1]&lt;/td&gt; &lt;/tr&gt;";
  
            $choices=  mysql_query("select choices_id,choices_descriptions
          from quiz_choices where course_code='MATH220' &amp;&amp; 
          question_number='$questions[0]'ORDER BY RAND() ");
  
            if (!$choices) die ("Database access failed: " . mysql_error());
  
            while($questionchoices=  mysql_fetch_array($choices)){
  
               echo "&lt;tr&gt;&lt;td&gt;&lt;input type='radio' value='$questionchoices[0]' 
            name='$questions[0]'/&gt;$questionchoices[1]&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";}
             }}?&gt;
      &lt;input type="submit" id="btn_submit" name="btn_submit" value="submit" /&gt;
        &lt;/form&gt;
  </code></pre>
  
  <p>Submitting.php</p>
  
  <pre><code>  &lt;?php
  
      require_once 'connect.php';
      session_start();
      $numCorrect = 0;
      $answers=array();
  
      if(isset($_SESSION['array'])){
           print_r ($_SESSION['array']); //it is not printing the same array as $correct,It is only printing one element
          $correct=$_SESSION['array'];
  
      foreach($correct as $key=&gt;$val){
         $answers=$_GET['$questions[0]'];//trying to get the values of the radio buttons and store it in array
          print_r($answers);// displaying Array word only
  
     if($val = $answers[$key]){
     $numCorrect++;
      }
       }  }?&gt;
  </code></pre>
  
  <p>The array session is not displayed the same,also I didn't know how can I fill the value of the radio buttons in the array.I am trying to compare the correct answers.
  Thank you in advance</p>