[eluser]zend[/eluser]
I dont understand how to use this?? Is dont work with me..
My Controoller
Code:
public function delite_page($id)
{
$this->Page_Model->delitePage($id);
$rows_to_delete = $this->input->post('item');
redirect('page/', 'refresh');
}
Model
Code:
public function delitePage($id)
{
$this->db->where('id', $id);
$this->db->delete('pages');
}
View
Code:
SCRIPT LANGUAGE=JavaScript
$('#delete').click(function() {
var rows_to_delete = $('107').serilize();
$.post('page/delite_page/', rows_to_delete, function(data) {
// Do some cool stuff like remove the rows
});
});
/SCRIPT
<a href="page/delite_page/"> Delete </a>
<?php foreach ($query as $row):?>
<tr>
<td><input type="checkbox" name="item[]" value="<?php echo $row->id; ?>" /></td>
<td><?php echo $row->id;?></td>
<td><?php echo $row->title;?></td>
<td><?php echo $row->author;?></td>
<td><?php echo $row->parent;?></td>
<td><?php echo $row->date_created;?></td>
</tr>
<?php endforeach?>
Dont work i dont know whay? Please help me i dont udnerstand.
Sorry my English is bad.