FlyingNimbus
FlyingNimbus

Reputation: 445

Flashdata empty in view

At the end of my controller I have this code:

print_r($this->session->all_userdata());
$this->load->view('common/site_header');

On the first line of my site_header file I have:

print_r($this->session->all_userdata());

The first print_r contains;

[flash:new:error] => Formulier niet correct ingevuld.

The print_r in the site_header file does not contain this entry, after I resubmit the form the second print_r contains:

[flash:old:error] => Formulier niet correct ingevuld.

It looks to me as if the view has a different session object and is one request behind or something.

How do I get the flashdata in the view in the same request?

Upvotes: 0

Views: 726

Answers (1)

Filippo oretti
Filippo oretti

Reputation: 49813

flash data is available only for the next request, use $this->session->userdata(); instead

Upvotes: 1

Related Questions