flashdata not working as expected without redirect() |
[eluser]shelton_dev_guy[/eluser]
Hi all, I am developing an application that makes use of session->flashdata() for error/success messages on pages that use forms. As the admin of the site, I also use the Profiler to track what queries are being executed. When I enabled the profiler, I noticed that some of the queries were not showing up. For example, when a user wants to update their profile, a db->update() function is executed. After some digging, I realized that when I update the database, I set a flashdata variable and redirect to the same page, and the queries were not being saved to display in the profiler, but the flashdata never fails. When I modify my controller to load->view() instead of redirect(), the profiler shows the query, but now my flashdata is all messed up - it will never show until the next page load (sometimes 2 page loads.) All I did was comment out the redirects, as shown below. Controller: Code: if ($this->form_validation->run() !== false){ View: Code: <h1>Edit Your Profile</h1> Other information that may be useful: Config: Code: $config['sess_use_database'] = TRUE; Is there a better (native CI) solution for success/error messages other than using session->flashdata()? I'm not opposed to adding an extra library or a function to one of my custom helpers, but it seems like this can be fixed without a bunch of excess coding. If this post is not in the right area, can a mod please move it? Thanks,
[eluser]danmontgomery[/eluser]
http://ellislab.com/codeigniter/user-gui...sions.html Quote:Flashdata
[eluser]pickupman[/eluser]
What happens when you try Code: if ($this->form_validation->run() !== false){
[eluser]shelton_dev_guy[/eluser]
@noctrum So loading a view doesn't really make another http request? @pickupman If your solution does not work, I will try n0xie's library. Thanks for the replies!
[eluser]danmontgomery[/eluser]
[quote author="shelton_dev_guy" date="1285967180"]@noctrum So loading a view doesn't really make another http request?[/quote] No... redirect() makes another http request
[eluser]shelton_dev_guy[/eluser]
--Edited-- My question changed, so I will make another post. Thanks for the help -- I am going to use n0xie's message lib. |
Welcome Guest, Not a member yet? Register Sign In |