title: 3 arrays in one foreach loop insert in database
body: <p>So i have a page that looks like this (After i filled it in)</p>
  
  <p><img src="https://i.stack.imgur.com/CGccQ.png" alt="How the page looks"></p>
  
  <p>And i have a database table that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/HCeCk.png" alt="what the database looks like"></p>
  
  <p>Now, after i press the button: <code>"Add to summary"</code>, i would like the info to be inserted in the database like this:</p>
  
  <p><img src="https://i.stack.imgur.com/62IsH.png" alt="What the database should look like"></p>
  
  <p>I did this before but then with 2 arrays, and now i have 3. Code it worked with:</p>
  
  <pre><code>    $train_id = $_POST['train_id'];
      $user_id = $_POST['user_id'];
          foreach (array_combine($train_id, $user_id) as $train_id =&gt; $user_id){
              $update_axle = $database-&gt;summary_add($train_id, $user_id);
          }
  </code></pre>
  
  <p>But now, i have <code>['summary_name']</code> extra.</p>
  
  <p>What my table looks like:</p>
  
  <pre><code>&lt;input type="text" name="summary_name[]" id="summary_name" required placeholder="Enter summary name"&gt;
  &lt;input type='hidden' name='user_id[]' value='&lt;?php echo $_GET['user_id']?&gt;'&gt;
  &lt;input type='hidden' name='train_id[]' value='&lt;?php echo $selected_train['train_id']?&gt;'&gt;
  </code></pre>
  
  <p>These give the correct value.
  Then when you press the <code>Add to summary</code> button, you will go to the page that should insert the values:</p>
  
  <p>Function:</p>
  
  <pre><code>function create_summary($train_id, $summary_name, $user_id) {
              $sql = "INSERT INTO summary "
          . "(summary_id, user_id, summary_name, train_id)"
          . "VALUES (summary_id, :user_id, :summary_name, :train_id) ";
              $sth = $this-&gt;pdo-&gt;prepare($sql);
              $sth-&gt;bindParam(':user_id', $_POST['user_id'], PDO::PARAM_INT);
              $sth-&gt;bindParam(':summary_name', $_POST['summary_name'], PDO::PARAM_STR);
              $sth-&gt;bindParam(':train_id', $_POST['train_id'], PDO::PARAM_INT);
              $sth-&gt;execute();
      }
  </code></pre>