Flashdata |
[eluser]Unknown[/eluser]
Hello I am facing erratic behavior when using flash data for displaying some messages in my views. Basically, I am setting the flashdata in the controller and am displaying in the view. I was not getting the message till I do a submit twice and I was getting the message when I was not expecting it. I did some debugging and believe that I have found the issue - Following is the piece of code in session.php of CI 1.7.2 for flashdata function: Code: function flashdata($key) I changed the "old" to "new" in the above method and the behavior was as expected by me. Here is the new code: Code: function flashdata($key) Is this really a bug in the session.php or am I doing something incorrect in the way I am using flashdata. I can provide more details if needed by any one. thanks Rajs
[eluser]Craig A Rodway[/eluser]
[quote author="rskommu" date="1261536049"]Basically, I am setting the flashdata in the controller and am displaying in the view[/quote] This is your problem. Flashdata isn't designed to be used like that. From the User Guide: Quote:CodeIgniter supports "flashdata", or session data that will only be available for the next server request, and are then automatically cleared. A solution to what you want to do would be to just pass the data you want in the view as variables. Code: $this->load->view('myview', array('flashmessage' => 'Hello, world!'))
[eluser]Unknown[/eluser]
Thanks! Silly mistake by me. I should have realized this. |
Welcome Guest, Not a member yet? Register Sign In |