title: PHP multiple textbox array
body: <p>I have array of textbox</p>
  
  <pre><code>&lt;form method="POST"&gt;
    &lt;input type="text" name="partnumber[]" value="1234"&gt;
    &lt;input type="text" name="desc[]" value="used"&gt;
    &lt;input type="text" name="qty[]" value="24"&gt;
    &lt;input type="text" name="partnumber[]" value="2345"&gt;
    &lt;input type="text" name="desc[]" value="good"&gt;
    &lt;input type="text" name="qty[]" value="31"&gt;
    &lt;input type="text" name="partnumber[]" value="3456"&gt;
    &lt;input type="text" name="desc[]" value="brand new"&gt;
    &lt;input type="text" name="qty[]" value="22"&gt;
    &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>after posting, i want to insert to my database like this. with the same ref_id.</p>
  
  <pre><code>last_insert_id = 17;
  
  id | ref_id | partnumber| description | quantity
  1  | 17     | 1234      | used        | 24
  2  | 17     | 2345      | good        | 31
  3  | 17     | 3456      | brand new   | 22
  </code></pre>
  
  <p>any help will be appriciated. thanks..</p>
  
  <pre><code>$comma  = "";
  $values = "";
  $last_id = 17;
  foreach ($partnumber as $p) {
      foreach ($desc as $d) {
         foreach ($qty as $q) {
          }
      }
       $values .= $comma."($id,$last_id,'$p','$d','$q')";
       $comma = ",";
  }
  
  
  $sql = "INSERT INTO parts_replaced (id,last_id,partnumber,description,quantity) VALUES $values";
  </code></pre>