couldn't show or collect data from checkbox

Problems with the Windows version of XAMPP, questions, comments, and anything related.

couldn't show or collect data from checkbox

Postby kwokwai » 26. March 2010 10:42

Hi all,

I am using cakePHP 1.26. in xampp 1.73 for windows.
I am building a simple page to collect data from a form and delete a specific row of data.

here is part of the source code in views/post/index.ctp:
Code: Select all
<?php echo $form->create(null,array('url' => '/cake126/post/deleting, 'type'=>'get'));?>       
<input type="checkbox" value="1" name="which[]">
<input type="checkbox" value="2" name="which[]">
<input type="checkbox" value="3" name="which[]">
<?php echo $form->end('Delete');?>



here is part of the source code in controllers/post_controller.php:
Code: Select all
function deleting() {
debug($this->data);
}


The debug function didn't show any data.

Could anyone help me out please?
kwokwai
 
Posts: 3
Joined: 22. March 2010 05:08

Re: couldn't show or collect data from checkbox

Postby kyha29 » 04. April 2010 02:52

it is easy just use this



$b_array = $_get['which'];

for ($i=0; $i<count($b_array); $i++)
{
echo $b_array[$i];
}
kyha29
 
Posts: 9
Joined: 03. April 2010 16:03


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 29 guests