title: Storing $_Post values to array in php
body: <p>Sorry I don't know how to explain it in title so I just explain it here.</p>
  
  <p>So I have this html and I want to store this in array, this is the code below</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;
  &lt;input name="grade_id[]" value="4" type="hidden"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q1_grade[]"&gt;94&lt;/input&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q2_grade[]"&gt;89&lt;/input&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q3_grade[]"&gt;90&lt;/input&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q4_grade[]"&gt;88&lt;/input&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;input name="grade_id[]" value="7" type="hidden"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q1_grade[]"&gt;95&lt;/input&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q2_grade[]"&gt;77&lt;/input&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q3_grade[]"&gt;77&lt;/input&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="q4_grade[]"&gt;98&lt;/input&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Now from above code I want to manipulate the datas in an array so I put the data specifically in array which the <code>id</code> has its own <code>$q1 $q2 $q3 $q4</code> to do this is as per code below</p>
  
  <pre><code>&lt;?php
   $grade_idArray = $_POST['grade_id'];
   $q1_gradesArray = $_POST['q1_grade'];
   $q2_gradesArray = $_POST['q2_grade'];
   $q3_gradesArray = $_POST['q3_grade']; 
   $q4_gradesArray = $_POST['q4_grade'];
  
   $grade = array();
   $gf = array();
  
   foreach($grade_idArray as $g)
   {
      foreach($q1_gradesArray as $q1)
      {
        foreach($q2_gradesArray as $q2)
        {
          foreach($q3_gradesArray as $q3)
          {
              foreach($q4_gradesArray as $q4)
              {
                  $grade = array($g,$q1,$q2,$q3,$q4);
              }
          }
        }
      }
    }
  
   echo var_dump($grade);
   ?&gt;
  </code></pre>
  
  <p>But the output data that I am receiving is just one array instead of two arrays. how should i do it?</p>
  
  <pre><code>array(5) { [0]=&gt; string(2) "7" [1]=&gt; string(2) "95" [2]=&gt; string(2) "77" [3]=&gt; string(2) "77" [4]=&gt; string(2) "98" }
  </code></pre>