Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing CodeIgniter how do I save user info from checkbox in a cookie?
    text
    copied!<p>There is a page that I am working on that has a sort of ToDo checklist on it, that I need to create a cookie for so that when a user comes back to the page everything they have previously checked off will show. I have seen so many different ways of accomplishing it, but I am having difficulty translating the bits I have seen over to my CodeIgniter built page. What is the best way of getting this to work? Here is what I am working with so far.</p> <blockquote> <p>Inside of the view file</p> </blockquote> <pre><code>&lt;section class="chkBoxes"&gt; &lt;ul&gt; &lt;li&gt;&lt;?php echo form_checkbox('toDoBox', 'reviewed', FALSE); ?&gt; Test&lt;/li&gt; &lt;li&gt;&lt;?php echo form_checkbox('toDoBox', 'reviewed', FALSE); ?&gt; Test&lt;/li&gt; &lt;li&gt;&lt;?php echo form_checkbox('toDoBox', 'reviewed', FALSE); ?&gt; Test&lt;/li&gt; &lt;li&gt;&lt;?php echo form_checkbox('toDoBox', 'reviewed', FALSE); ?&gt; Test&lt;/li&gt; &lt;li&gt;&lt;?php echo form_checkbox('toDoBox', 'reviewed', FALSE); ?&gt; Test&lt;/li&gt; &lt;/ul&gt; &lt;/section&gt; </code></pre> <p>Had this working in my test.php page but get errors when I moved this into CI</p> <blockquote> <p>Inside of the controller</p> </blockquote> <pre><code>$this-&gt;session-&gt;set_userdata(''); $aDoor = $_POST['toDoBox']; if(empty($aDoor)) { echo("Please mark what you have read before continuing."); } else { $N = count($aDoor); echo("You have completed $N sections: "); for($i=0; $i &lt; $N; $i++) { echo($aDoor[$i] . " "); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload