title: Carrying a checkbox selection in a session
body: <p>How do I wrap the selections in a session that can be carried over multiple pages?</p>
  
  <p>This is what I have:</p>
  
  <pre><code>session_start();
  
  
  &lt;form action="checkbox-form.php" method="post"&gt;
  Select your options&lt;br /&gt;
  &lt;input type="checkbox" name="options[]" value="A" /&gt;A&lt;br /&gt;
  &lt;input type="checkbox" name="options[]" value="B" /&gt;B&lt;br /&gt;
  &lt;input type="checkbox" name="options[]" value="C" /&gt;C&lt;br /&gt;
  &lt;input type="submit" name="formSubmit" value="Submit" /&gt;
  &lt;/form&gt;
  
  
  var_dump($_POST['options']);
  
  
  foreach($_POST['options'] as &amp;$option){
    mysql_real_escape_string($option);
  }
  
  
  $insert = "INSERT INTO submitted (statuses)       
  VALUES ('". implode(",", $_POST['options']) ."')";      
  
  $query = mysql_query($insert) or die ("Error: ".mysql_error());  
  </code></pre>
  
  <p>So, how do I put <code>$_POST['options'];</code> in a session.  I tried doing </p>
  
  <pre><code>$_SESSION['options'] = mysql_real_escape_string($_SESSION['options']);
  </code></pre>
  
  <p>When i do that i get "array" as the result.</p>