title: Storing all selected check box values in one variable?
body: <p>I came up here with little silly question i have retrieved all selected values from check boxes and store the values in database but i want to store all the selected values from check box to a single variable like i want to bind all the value and than want to store it in single database column.here is my little effort.</p>
  
  <pre><code>&lt;?php
  
  $con=mysql_connect("localhost","root","");
  mysql_select_db("checkboxes",$con);
  if(isset($_POST["Submit"]))
  {
  $checkbox1 = $_POST['chk1'];
  $i=0;
  $user="admin";
  $store;
  while($i&lt;sizeof($checkbox1)) {
      echo $checkbox1[$i];
  $query="INSERT INTO `speciman`(`type`, `user`) VALUES ('".$checkbox1[$i]."','".$user."')";
  mysql_query($query) or die ('Error updating database');
  $store=$checkbox1[$i];
  $i++;
  }
  
  echo '&lt;br/&gt;';
  echo "Record is inserted.";
  }
  
  else
  {
  
  }
  ?&gt;
  </code></pre>
  
  <p>And the form is here.</p>
  
  <pre><code>&lt;form action="" method="post" enctype="multipart/form-data"&gt;
  &lt;input type="checkbox" name="chk1[]" value="blood"&gt;blood&lt;br /&gt;
  &lt;input type="checkbox" name="chk1[]" value="bone"&gt;bone&lt;br /&gt;
  &lt;input type="checkbox" name="chk1[]" value="urine"&gt;urine&lt;br /&gt;
  
  &lt;br&gt;
  &lt;br&gt;
  &lt;input type="submit" name="Submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>