I am using Codeigniter 2.1.4 and I have facing some issues with flashdata.
When I successfully submit record I can display the flashdata message. But if go to the other page from the page where flashdata message was displayed and then go back to previous page using browser back button it shows me flashdata message again.
How to clear flashdata message once it used?
I think its not the flashdata issue its cache problem. I am confused why this is happening. If its cache issue then how to remove it?
Below is code I have used,
//In the manage of controller
$this->session->set_flashdata('message', "Record updated successfully.");
// In the view of controller
$data['message'] = $this->session->flashdata('message');
// In the view page
echo $message;
redirect()
somewhere so you (mostly your users) wont have to deal with "Do you want to resend data?" nag that Chrome/Firefox provides. – Broadheader("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate");
in index.php it works fine. Is this good option for removing caching issue? – Effronteryredirect()
) not for screwing around with headers. But you solved your problem, we do not have the big picture as you have (why is there a need for back button to work -redirect()
solves this "issue"). – Broad