title: Looping through $_POST array values with PHP
body: <p>If I have this $_POST array:</p>
  
  <pre><code>session[1][0]=50&amp;
  session[1][1]=60&amp;
  session[2][0]=70&amp;
  session[3][0]=80
  </code></pre>
  
  <p>How can I use a for loop to get the value of the session and of the item? I thought this would work but it does not.</p>
  
  <pre><code>foreach ($_POST['session'] as $i =&gt; $value) {
      $session = $session[$i];
      $item = $value;
  
      $query-&gt;bindValue(':session', $session, PDO::PARAM_INT);
      $query-&gt;bindValue(':item', $value, PDO::PARAM_INT);
      $query-&gt;execute();
  
  }
  </code></pre>
  
  <p>So that the first iteration of the loop would produce $session=1 and $item=50?</p>