question for flashdata |
[eluser]Shiro[/eluser]
Dear all, I have a question for the flashdata, I had learn from the book from Wrox, Professional CodeIgniter This is the source code, I download from http://www.wrox.com/WileyCDA/WroxTitle/P...NLOAD.html I found that for the admin login, flashdata doesn't work correctly. The first time I type wrong username and password, no error display, when I type it second time then the error will be display. I do another testing on it. In a view page, I added $this->session->set_flashdata('test', '<div class=\'message\'>test</div>'); echo $this->session->flashdata('test'); The first time view the page, the flashdata test didn't show out, only I refresh it then it come out, I deleted the cookie and run the code again still didn't displayed. It has to be run second time then the flashdata will display, I am a bit confuse about the flashdata usage.
[eluser]Shiro[/eluser]
I found out answer, after use the flashdata For example, $this->session->set_flashdata('error', '<div class=\'message\'>Sorry, your username or password is incorrect!</div>'); It must be follow by refresh the page redirect('welcome/admin','refresh'); if not the message would not display out, it need to run second time. This is why, the set_flashdata('test','value') does work in the first place. I think this is related with the machanism cookie, maybe the wiki of the flashdata need to state it out. |
Welcome Guest, Not a member yet? Register Sign In |