Flashdata not clearing on refresh/redirect |
Using CI 3.1.11:
I am sending a flashdata error message when a form is filled incorrectly. The message is appearing correctly but does not clear on refresh/redirect. Controller method includes: Code: $this->session->set_flashdata('message', '<div class="alert alert-danger">The fields Model, Actual, Photo, Drawing and Painting can only be either blank or contain X</div>'); The session array looks like this: Code: array (size=5) I have researched this extensively via Google but have seen nothing helpful. As a further note, I have changed flashdata to tempdata with an expiry time of 10sec and the same behaviour persists. I can read the error message but it does not expire and refreshing the screen does not get rid of the message. I have to log out and log in again to do that.
Well,
in your controller: 1- get the data from your view (You can check the link I am leaving for step 2) 2 check if they pass your rules or not (Follow this link) 3- if yes, pass them to model. 4- if not, turn back an error (no need for flashdata). - - - - 3- If you pass your data to model and to database successfully then you can call your flashdata, like: PHP Code: $data = [ By the way, why don't you go with CI 4?
Well my existing controller method follows the same pattern:
Code: public function log_illustration_update($id)
Looks like this will be fixed in 3.1.12: https://github.com/bcit-ci/CodeIgniter/pull/6013
[quote pid="384357" dateline="1613123894"]
You can use unset($_SESSION['some_name']); after calling session data on view [/quote]
If your writing an application it is best to leave caching turned off while testing yurn it on when you need to
test the caching. You can also use the new opcache in php which will speed up your app 10 fold. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |