[eluser]Jeka[/eluser]
Hi,
I've run into this weird problelm with flashdata. Code snippet:
Code:
function edit_entry($id) {
$this->data['entry'] = $this->ion_auth->get_user($id);//get the user
if (!$this->data['entry']) { //bail if can't retrieve
$this->session->set_flashdata('status', 'error');
$this->session->set_flashdata('message', "Unable to load this entry for edit");
redirect('admin/manage_entries', 'refresh');
}
$this->load->view('admin/edit_entry',$this->data);
}
Here's what happens:
If the user can't be retrieved, it's supposed to refresh away.
However, the flash data is being set without redirect. So every time I refresh the edit_entry page, I get an error message - even if the record is retrieved successfully. I get that exact error message, it's the only place in code it's ever set. If I comment out the set_flashdata then it obviously never sets and the page works fine.
Does anyone know what can be causing this? It doesn't make sense to me: if we ever got to setting flash data, it would redirect. If not, then the flash data shouldn't be set. So here I get no redirect and the flash data is being set.
Edit: also, if I pass an incorrect ID, it properly redirects.