Why is it not deleting? When I press delete, I should get the id of the row that I will delete.
View:
<?php
foreach ($cust_data as $row) {
echo '<tr class="even pointer">';
echo '<td class="a-center ">';
echo '<input type="checkbox" class="tableflat">';
echo '</td>';
echo'<td>' . $row->cust_id . '</td>';
echo'<td>' . $row->firstname . '</td>';
echo'<td>' . $row->lastname . '</td>';
echo'<td>' . $row->email . '</td>';
echo'<td>' . $row->contact_number . '</td>';
echo'<td>' . $row->address . '</td>';
echo'<td>';
echo '<a href="' . base_url() . 'administrator/delete?id=' . $row->cust_id . '">Delete</a>';
echo'</td>';
echo'</tr>';
}
?>
Model:
public function delete($id) {
$this->db->delete('customer', array('cust_id' => $id));
}
Controller:
public function delete() {
$this->load->model('admin_model');
$this->admin_model->delete($this->input->get('cust_id'));
$this->customer();
}
$this->input->get('cust_id')should be$this->input->get('id')that's why it doesn't get the value because you are retrieving a wrong/unsetted posted data