title: How to save repetitive fields to database with a foreign key in PHP / WordPress?
body: <p>The following fields are repetitive / repeated in my form:</p>
  
  <pre><code>&lt;input type="text" name="BrotherAdmissionNumber[]" /&gt;
  &lt;input type="text" name="BrotherName[]" /&gt;
  &lt;input type="text" name="BrotherGrade[]" /&gt;
  &lt;input type="text" name="BrotherClassTr[]" /&gt;
  </code></pre>
  
  <p>the foreign key comes from this:</p>
  
  <p>$unique_id_generated - this is generated during the form submission and saved in a table called 'admission'</p>
  
  <p>What I am trying to do this is,</p>
  
  <p>I want to insert this into db like one row with one brother details.</p>
  
  <p>so let's say if the foreign key is ZKHYT6 then the rows should be like this for a person who has three brothers.</p>
  
  <pre><code>FK      admission No   Name    grade    Tr
  ------  ------------   -----   -------  ------------
  ZKHYT6  7721           John     10      Mrs. Johnathan
  ZKHYT6  8975           Bobby    09      Mr. Parkinson
  ZKHYT6  6585           Smith    11      Mrs. Camp
  </code></pre>
  
  <p>And I want to insert this to a custom table called '<em>brothers</em>' in WordPress.
  How to set up this table with a foreign key $<em>unique_id_generated</em> from the table '<em>admission</em>'</p>
  
  <p>I can do this like below only if these are normal fields</p>
  
  <pre><code>$wpdb-&gt;insert( 
      'brothers', 
      array(
          'applicationID' =&gt; $unique_id_generated, 
          'BrotherAdmissionNumber' =&gt; $BrotherAdmissionNumber, 
          'BrotherName' =&gt; $BrotherName, 
          'BrotherGrade' =&gt; $BrotherGrade,
          'BrotherClassTr' =&gt; $BrotherClassTr 
      )
  );
  </code></pre>
  
  <p>The above will insert a single row to the table '<strong>brothers</strong>'</p>
  
  <p>How can I insert the repeated fields with a foreign key?</p>