Welcome Guest, Not a member yet? Register   Sign In
flashdata lag
#1

[eluser]extra_rice[/eluser]
i have sess_use_database = true...

i have a form that submits to my controller's function called login...
my controller's function calls an autoloaded library called user...
checks for the username/password credentials... returns true if user exist and false if otherwise...



Code:
if ($this->user->login($this->input->post('username'),$this->input->post('username')))
{
   $this->session->set_flashdata('msg','You are now logged in.');
   $this->load->view('home');
}
else
{
   $this->session->set_flashdata('msg','Login failed');
   $this->load->view('login');
}


i have both my home and login views implement this:

Code:
echo $this->session->flashdata('msg');

the first form submission from login page doesn't generate any flashdata... say you provided an invalid login... do an invalid login again and what happens is that flashdata previously set appears... so when you do a valid login and home view gets loaded you still get the 'Login failed' flashdata... can't figure out what's with the lag... please help... :-(
#2

[eluser]Armchair Samurai[/eluser]
Flash data is handled by cookies - you need to redirect to another page. You cannot set a cookie than read it on the same document load AFAIK.
#3

[eluser]extra_rice[/eluser]
got it... thanks!




Theme © iAndrew 2016 - Forum software by © MyBB