title: How to insert into MYSQL row from multiple $_POST arrays
body: <p>I have a form with an "add contact" section, where upon a click, it adds another row to the form with 3 more input boxes. (The segment of code on jfiddle: <a href="http://jsfiddle.net/fmdx/cYxYP/" rel="nofollow">http://jsfiddle.net/fmdx/cYxYP/</a>)</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;form method="post" action=""&gt;
  &lt;div style="padding-left:40px;"&gt;
  &lt;div id="customcopies" style="padding-left:40px;"&gt;
  1. Name: &lt;input type="text" id="copiestoname_1" name="copiestoname[]" placeholder="Jane Doe Smith" required&gt;, Institution: &lt;input type="text" id="copiestoinst_1" name="copiestoinst[]" placeholder="Bank" required&gt;, Method: &lt;input type="text" id="copiestomethod_1" name="copiestomethod[]" placeholder="Email" required&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;input type="submit" name="submit_val" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>With this being the PHP/MYSQL for insertion:</p>
  
  <pre><code>if (isset($_POST['submit_val'])) {
      foreach ($_POST['copiestoname'] as $key=&gt;$value) {
      $copiestoname = mysql_real_escape_string($value);
  
          mysql_query("INSERT INTO copiesto (name) VALUES ('$copiestoname')") or die(mysql_error());
          echo "Completed";
      }
  echo "" . count($_POST['copiestoname']) . " Names Added&lt;br&gt;";
  mysql_close();
  }
  </code></pre>
  
  <p>The table in the database is:</p>
  
  <pre><code>Table Name: copiesto
  +-------------+-------------+-------------+---------+
  | index       |  name       | institution | method  |
  +-------------+-------------+-------------+---------+
  </code></pre>
  
  <p>How would I expand the current MYSQL code to accept entries from the other 2 arrays and input their data into the same MYSQL row during that loop?</p>