title: displaying selected checkboxes in cakephp
body: <p>I want to get the selected checkboxes from a list. 
  I am getting below errors/warnings</p>
  
  <blockquote>
    <p>paramater 1 not being a string (at for loop).</p>
  </blockquote>
  
  <p>The checkboxes have a <code>ID</code> field so when a checkbox is selected I simply want to get this <code>ID</code> of that row called <code>checkid</code>. </p>
  
  <p>I cant seem to cycle through the list one at a time and too check what field has been checked.</p>
  
  <p>I have tried all sorts of combinations and I don't know exactly the correct method for this.</p>
  
  <p>I didn't find it here
  <a href="http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html" rel="nofollow">http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html</a></p>
  
  <p><strong>controller</strong></p>
  
  <pre><code>   if (isset($this-&gt;request-&gt;data['addrecord'])) {   
  
                 foreach ($this-&gt;request-&gt;data as $key =&gt; $item): 
  
  
  
             if (isset($item['checkid'])){
                if ($item['checkid']&gt;0){ 
  
                 // $lessonId=($item['id']);
                  debug($item['checkid']); //no output
  
                }
              }
  
  
            endforeach;
  
  
  
  view//
  
      echo '&lt;td&gt;'.$this-&gt;Form-&gt;checkbox('User.'.$key.'.checkid', 
                         array('value'=&gt;$student['Student']['id'], 'checked'=&gt;0)).'&lt;/td&gt;';
  </code></pre>
  
  <p><strong>output where I cant get the individual checkid</strong> </p>
  
  <pre><code>  array(
      'addrecord' =&gt; 'Add Email(s)',
      'User' =&gt; array(
          'firstname' =&gt; 'a',
          'lastname' =&gt; '',
          'searchemail' =&gt; '',
          'id' =&gt; '372',
          (int) 0 =&gt; array(
              'checkid' =&gt; '216'
          ),
          (int) 1 =&gt; array(
              'checkid' =&gt; '311'
          ),
          (int) 2 =&gt; array(
              'checkid' =&gt; '0'
          ),
          (int) 3 =&gt; array(
              'checkid' =&gt; '0'
  </code></pre>