title: Insert multiple values to the same database column from HTML form
body: <p>I have created complex form, I'll try to provide simplified examples. There are ability to generate more fields by clicking <code>+</code> button. </p>
  
  <p>For example in form are fields:</p>
  
  <pre><code>Certificate    Date Of Issue    Date of Expire   
  [         ]    [           ]    [            ]   +
  </code></pre>
  
  <p>by clicking <code>+</code> button It add duplicate row (via javascript) so after clicking <code>+</code> button part of form looks like:</p>
  
  <pre><code>Certificate    Date Of Issue    Date of Expire   
  [         ]    [           ]    [            ]
  
  Certificate    Date Of Issue    Date of Expire  
  [         ]    [           ]    [            ]   +
  </code></pre>
  
  <p>There are ability to click <code>+</code> button as many times as user needs.</p>
  
  <p>In database table <code>CV_Certificates</code> I have columns <code>CertificateId</code>, <code>CertDateofIssue</code>, <code>CertDateOfExpire</code></p>
  
  <p>I'm using <code>insert.php</code> to insert values to database in following:</p>
  
  <pre><code>$Certificate = mysqli_real_escape_string($link, $_POST['Certificate']);             
  $CertDateOfIssue = mysqli_real_escape_string($link, $_POST['CertDateOfIssue']);             
  $CertDateOfExpire = mysqli_real_escape_string($link, $_POST['CertDateOfExpire']);
  
  $sql = "INSERT INTO CV_Certificates (Certificate, CertDateOfIssue, CertDateOfExpire) VALUES ('$Certificate','$CertDateOfIssue','$CertDateOfExpire')
  
  if(mysqli_query($link, $sql)){
      echo "Resume created successfully.";
  } else{
      echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
  }
  </code></pre>
  
  <p>It inserting values only from 1 row, but It should insert values from all added rows to multiple database table's rows.</p>
  
  <hr>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;fieldset class="fieldset-borders"&gt;
  &lt;legend&gt;5. Certificates&lt;/legend&gt;
  
  &lt;ul class="Certificates" id="Certificates"&gt; 
      &lt;li&gt;
          &lt;ul class="column"&gt;         
              &lt;li&gt;
                  &lt;label for="Certificate"&gt;Certificate Name&lt;/label&gt;
                  &lt;input id="Certificate" type="text" name="Certificate" class="field-style field-split25 align-left" placeholder="Certificate" /&gt;    
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;   
      &lt;li&gt;
          &lt;ul class="column"&gt;         
              &lt;li&gt;
                  &lt;label for="CertDateOfIssue"&gt;Date of Issue&lt;/label&gt;
                  &lt;input id="CertDateOfIssue" type="date" name="CertDateOfIssue" class="field-style field-split25 align-left" placeholder="Date of Issue" /&gt;  
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
          &lt;ul class="column"&gt;         
              &lt;li&gt;
                  &lt;label for="CertDateOfExpire"&gt;Date of Expire&lt;/label&gt;
                  &lt;input id="CertDateOfExpire" type="date" name="CertDateOfExpire" class="field-style field-split25 align-left" placeholder="Date of Expire" /&gt;   
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt;   
  &lt;ul class="Certificates1"&gt;&lt;/ul&gt;
  &lt;button type="button" class="add-row1"&gt;+&lt;/button&gt; 
  
  &lt;/fieldset&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>$(document).ready(function(){
     $( ".add-row1" ).click(function(){
        $( "ul.Certificates" ).first().clone().appendTo( ".Certificates1" ).append('&lt;button class="remove"&gt;X&lt;/button&gt;').find('input').val("");
     });
     $( "body" ).on('click', '.remove', function(){
      $(this).closest('.Certificates').remove();
    });
  });
  </code></pre>
  
  <p>How could I achieve It? Also as I noticed, this is extremely simplified form, there are over 150 fields at all.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>This is real part from my code which return an error: <code>ERROR: Could not able to execute .</code> And not inserting values to database at all now.</p>
  
  <pre><code>foreach($SeaService as $key=&gt;$res) {
  
  $sql2 = "INSERT INTO CV_SeaServices (
  UserId
  ,NameOfVessel           
  ,TypeOfVessel           
  ,YearBuilt              
  ,Flag                   
  ,DWT                    
  ,TypeOfMEkW             
  ,SSRankApplied          
  ,SignOn                 
  ,SignOff                
  ,CompanyName            
  ) VALUES (
  '$res',
  '$NameOfVessel[$key]',      
  '$TypeOfVessel[$key]',      
  '$YearBuilt[$key]',             
  '$Flag[$key]',              
  '$DWT[$key]',               
  '$TypeOfMEkW[$key]',        
  '$SSRankApplied[$key]',         
  '$SignOn[$key]',            
  '$SignOff[$key]',           
  '$CompanyName[$key]')";
  
  };
  if(mysqli_query($link, $sql2)){
      echo "Resume created successfully.";
  } else{
      echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
  }
  </code></pre>