title: MySQL and PHP multiple checklist db insert
body: <p>I am trying to insert the value of this multiple checklist into the db column. This code not working. Can anyone spot the problem?</p>
  
  <p>My database consists of a table called "colors" and one column called "color".</p>
  
  <pre><code>&lt;?php
  // connect to database
  require "mysql_connect.php";
  ?&gt;
  
  
  &lt;?php
  // get value from the form
  $color = $_POST['color'];
  
  foreach($_POST['color'] as $colors){
  $insert = mysql_query("INSERT INTO colors (color) VALUES ('$color')");
  }
  ?&gt;
  
  &lt;form action="add_color.php" method="post" enctype="multipart/form-data" name="colorform"     id="colorform"&gt;
  
  &lt;input type="checkbox" name="color[]" value="black" /&gt; Black
  &lt;input type="checkbox" name="color[]" value="red" /&gt; Red
  &lt;input type="checkbox" name="color[]" value="blue" /&gt; Blue
  &lt;input type="checkbox" name="color[]" value="white" /&gt; White
  
  &lt;input name="submit" type="submit" value="Add color" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Thanks</p>