title: Dimensional array items are not inserting in the same DB row
body: <p>I start with the following:</p>
  
  <pre><code>&lt;form action="" method="post" enctype="multipart/form-data" id="form"&gt;
   &lt;?php foreach($attributes as $attribute){ ?&gt;
    &lt;input type="checkbox" name="attribute[][attr_id]" value="&lt;?php echo $attribute['attribute_id']; ?&gt;"&gt;
    &lt;input type="text" name="attribute[][attr_name]"&gt; value="&lt;?php echo $attribute['attribute_name']; ?&gt;"&gt;
   &lt;?php } ?&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So each $attribute has a checkbox and a text input; whenever someone would check (one or more boxes) and would insert text (only to the checked items) I want to get in the DB the <code>[attr_id]</code> and the <code>[attr_name]</code> for the specific item.</p>
  
  <p>So I continue with the following:</p>
  
  <pre><code>if(isset($_POST['attribute'])){
   foreach($_POST['attribute'] as $attribute){
      $attr_id = $attribute['attr_id'];
      $attr_name = $attribute['attr_name'];
  
      "INSERT INTO " . DB_PREFIX . "attribute_xref SET productid = '" . $productid . "', attribute_id='". $attr_id ."', attribute_name='" . $attr_name . "'";
    }
   }
  </code></pre>
  
  <p>But, the result is a little different as of I would have expected. Every time a box is checked and its text input is typed, their values are sent to two different DB rows:</p>
  
  <pre><code>productid   --   attribute_id   --   attribute_name
  10          --       102        --        empty
  10          --        0         --       somename
  </code></pre>
  
  <p>On the above second row the attribute_id has zero value for not being checked.</p>
  
  <p>I cannot get the whole picture where is my mistake.</p>