I am trying to delete particular record using href. But it's not working properly when i click on button its passing in URL like this
http://localhost/project_x/Organisation/Organisation/%3C?php%20echo%20base_url();?%3EOrganisation/delete_org?id=3
I don't know where is the mistake can anyone help me.It's passing id in URL is correctly.
Here is my controller:
function delete_org() {
// Pass the $id to the org_delete() method
$this->Org_model->org_delete($id);
redirect('Organisation/organisation');
}
here is my redirect organisation function
public function organisation() {
$data['organisations'] = $this->Org_model->getOrganisations();
$this->load->view('template/header');
$this->load->view("organisation", $data);
$this->load->view('template/footer');
}
Here is my model:
function org_delete($id) {
$this->db->where('id', $id);
$this->db->delete('organisation');
}
And Here is my view buttons:
<?php
echo "<td class='text-center'><div class='btn-group btn-group-xs'><a href='#' data-logid='" . $org->id . "' data-target='#editGroups' data-toggle='modal' title='Edit' class='open_modal btn btn-default'><i class='fas fa-edit'></i></a>";
echo "<a href='<?php echo base_url();?>/Organisation/delete_org?id=$org->id' class='btn btn-danger confirmation'><i class='fas fa-times'></i></a></div></td></tr>";
?>
Can anyone help me where i did mistake.
Thanks in advance.