title: Insert multiple rows but not empty fields
body: <p>I have 4 rows that need to be inserted into db IF THEY ARE NOT EMPTY.
  But I can't make it work.</p>
  
  <p>this x 4 times</p>
  
  <pre><code>&lt;select class="form-control" id="masura" name="masura[]"&gt;
  &lt;option value='' &gt; -- &lt;/option&gt;
  &lt;option value='XS' &gt; XS &lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="text" class="form-control" id="stoc" name="stoc[]" &gt;
  </code></pre>
  
  <p>and this php</p>
  
  <pre><code>$row_data = array();
  foreach($_POST['stoc'] as $row=&gt;$stoc) {
      $stoc=mysqli_real_escape_string($link,$stoc);
      $masura=mysqli_real_escape_string($link,($_POST['masura'][$row]));
      $row_data[] = "('$masura', '$stoc' , '$dirName')";
  }
  
  if (!empty($row_data)) {
      $sql = 'INSERT INTO stoc (masura, stoc, prodid) VALUES '.implode
  
      (',', $row_data);
      $result = mysqli_query($link, $sql);
  }
  </code></pre>
  
  <p>the issue is that it will also insert empty fields (if I enter only 1 field, it will insert that field with other 3 ones empty)</p>
  
  <p>Thanks</p>