Flash Data Post

Asked

Viewed 126 times

-1

Good afternoon, you guys. I’m not getting a flash date through Post. When I upload my view I place a bank info on flash date:

 $this->session->set_flashdata('ticket_id',$dados[0]->caseId);

I have a modal in this view that sends the information via post to the controller "reply".

In this controller, I try to recover the flash data, but it is always empty.

If I use userdata works perfectly, with flash data no.

My question is whether by post the flash data keeps, or it can only be recovered after a redirect?

Thank you

1 answer

0

Beast, according to Codeigniter documentation 3.1.9.

Codeigniter Supports "flashdata", or Session data that will only be available for the next request, and is then Automatically cleared.

That is, the information set in flashdata will be available only in the next request and will automatically be deleted.

https://www.codeigniter.com/user_guide/libraries/sessions.html#flashdata

I think in this case it’s right to use userdata even.

  • Paulo, good night. Exact, it will only be available for 1 request. But a "Post" for a controller wouldn’t just be 1 request? View->POST->Controller

  • In this case, it will be available in the next requisition. For example, if this post is persisting some information and then displays the view, it will only work with userdata. Now, if after persisting you make a redirect (redirect), the flashdata will work.

  • Perfect Paul. Now it’s clear. hug

Browser other questions tagged

You are not signed in. Login or sign up in order to post.