Saturday, October 4, 2014

get the id's from checkbox list

Hi, I have a simple question. I display some data from a  table and all I want is the user to check the checkbox and click a button.
The button will then pass all the data to the controller Post? and I just go through an find out what checkboxes have been checked with the ID .

Like a list of rows marked for delete.

I have gone through the docs and I am still not getting anything in debug as I get an empty array.
The $id field has a value.


  public function index() {
     ..
        if ($this->request->is('post')) {
              $chk = array('Availtmp' => $this->request->data);
    
             // $chk =  $this->request->data;
              debug($this->request->data);
       
        }

   echo $this->Form->create(array('type' => 'post'));
                     foreach ($tutor as $item):
                         
                     ...  
                    
     
                           echo '<td>'.$this->Form->checkbox('available', array(
                             'value' => $id,
                               'checked'=>0)).'<td>'; 
                        //   debug()
                 
                         echo '</tr>';
                       
                  
                    
                     endforeach;
                  
             
                    echo $this->Form->end('check edits');

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: