title: Remember each of the checkbox selections in a session
body: <p>Ive got a 3 part form and i want to store the users selections in a session so if they need to go back and change a selection they can.</p>
  
  <p>The form consists of radio buttons and checkboxes. I have it working for the radio buttons they are stored in a session so it always remembers.</p>
  
  <p>I can't think how to go it working on the checkboxes as they are stored in an array.</p>
  
  <p>This is my form:</p>
  
  <p><img src="https://i.stack.imgur.com/gcmvU.png" alt="enter image description here"></p>
  
  <p>So when they select jam and Flora, i get an array like this</p>
  
  <pre><code>Array ( [0] =&gt; Jam [1] =&gt; Flora )
  </code></pre>
  
  <p>This is my checkbox:</p>
  
  <pre><code>&lt;input type="checkbox" name="&lt;?php echo $course_menuname."extras[]"; ?&gt;" &lt;?php if($_SESSION[''.$course_menuname.''] == $extraitems) { echo "checked"; } ?&gt; value="&lt;?php echo $extraitems; ?&gt;"&gt;
  </code></pre>
  
  <p>So i need a session to store each of the values they selected then if its one they selected put a check on the checkbox.</p>
  
  <p>Hope this makes sense.</p>
  
  <p>Thanks</p>