im creating a function to delete a contact record, then once deleted go to the view company page.
so here is my controller public function delete($id) {
if (isset($_GET["delete"]))
{
$this->Contacts_model->delete($id);
$url = "/company/view/" . $cid;
redirect($url);
}
}
and here is my model
public function delete($id)
{
$this->db->where('id', $id);
$this->db->delete('contacts');
}
on my view:
<a href="/contacts/delete/<?php echo $data['id']; ?>
which this works and will delete the contact, but obviously wont redirect to the company/view page becuase the CID isnt being passed.
i thought about adding this to the delete link
<a href="/contacts/delete/<?php echo $data['id']; ?>?delete&cid=<?php echo $data['cid']; ?>"
so that cid is being passed through the url. would this work some way?