I have a list of post and i want to delete them using multiple checkboxes. I followed this link Multiple Check boxes in cake php but i get this error(i use cakephp 2.4):
The view for PostsController::deleteSelect() was not found.
Confirm you have created the file: C:\xampp\htdocs\cakephp2\app\View\Themed\Cakestrap\Posts\delete_select.ctp
I want to access this data from index.ctp not from delete_select.ctp. My question is how i access this data "data['Post']['box'][]"?
My code is:
index.ctp
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['Post']['id']; ?></td>
<td>
<?php echo $this->Html->link($post['Post']['title'], array('action' => 'view', $post['Post']['id'])); ?>
</td>
<td>
<?php echo $post['Post']['created']; ?>
</td>
<td>
<?php echo $this->Form->checkbox('post',
array(
'value' => $post['Post']['id'],
'name' => "data['Post']['box'][]",
));?></td>
<td>
<?php echo $this->Form->postLink(
'Delete',
array('action' => 'delete', $post['Post']['id']),
array('confirm' => 'Are you sure?'));
?>
<?php echo $this->Html->link('Edit', array('action' => 'edit', $post['Post']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
<p><?php echo $this->Html->link('deleteSelect', array('action' => 'deleteSelect')); ?></p>
deleteSelect function
public function deleteSelect(){
if(!empty($this->data)) {
foreach($this->data['Post']['box'] as $key => $value){
$this->Post->delete($value);
}
$this->redirect(array('action' => 'index'));
}
}