Welcome Guest, Not a member yet? Register   Sign In
Flashdata not clearing on refresh/redirect
#1

(This post was last modified: 02-12-2021, 07:54 AM by msheath.)

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)
  'logged_in' => boolean true
  'firstname' => string 'Mike' (length=4)
  'lastname' => string 'Heath' (length=5)
  'message' => string '<div class="alert alert-danger">The fields Model, Actual, Photo, Drawing and Painting can only be either blank or contain X</div>' (length=129)
  '__ci_vars' =>
    array (size=1)
      'message' => string 'new' (length=3)
and I think the '__ci_vars' array element is what marks out 'message' as flashdata. Is that how it should appear? If correct, why does the session array stay the same when I refresh the browser tab?

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.
Reply


Messages In This Thread
Flashdata not clearing on refresh/redirect - by msheath - 02-12-2021, 02:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB