title: explode does not work
body: <p>This Code is for inserting Units for certain specifications.
  for example, if specification is length, then units are centimeter, meter and millimeter.</p>
  
  <p>When I try to read all units in single text field with commas and in PHP tried to explode the units with comma.
  But when I submit the form only the first unit is saved to DB.</p>
  
  <p>This is my database structure:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `tbl_unit` (
    `unit_id` varchar(5) NOT NULL,
    `unit_name` varchar(50) NOT NULL,
    `specification_id` int(11) NOT NULL,
    PRIMARY KEY (`unit_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>&lt;?php
  include("../config.php");
  $uid=$_POST['unitid'];
  $unit=$_POST['unitname'];
  $spec=$_POST['specification'];
  
  $arr1 = explode(',',$unit);
  $size=count($arr1);
  
  for($i=0;$i&lt;$size;$i++)
  {
    mysql_query("insert into tbl_unit values('".$uid."','$arr1[$i]','".$specification."')");
  
  }
   header('Location:addunit.php');
   ?&gt;
  </code></pre>
  
  <p>What is confusing me is that when I try to insert <code>$arr1[0]</code>, <code>$arr1[1]</code> or <code>$arr1[2]</code> separately the values are being saved. I think the for loop is executing only once. what is the problem with for loop?</p>