title: Nested foreach() in PHP
body: <p>I need some help with nested <code>foreach</code>.</p>
  
  <p>This is my code:</p>
  
  <pre><code>$program = $_POST['program'];
  $licence = $_POST['licence'];
      foreach($program as $p){
          foreach($licence as $l){
  mysql_query("INSERT INTO programs (pcname, program, licence) VALUES ('". $pcname ."', '". $p ."', '". $l ."')");
  
    }
  }
  </code></pre>
  
  <p>This doesn't work and I know why. But I cannot find a way to fix the issue. The issue is, that it is going through all the values in the inside <code>foreach</code>, then is is going through them all, all over again for the next value in the outside <code>foreach</code>.</p>
  
  <p>This probably wasn't explained very well, but hopefully you can understand what I am doing in trying to achieve, and to help me out.</p>