Welcome Guest, Not a member yet? Register   Sign In
Flashdata not being returned properly problem!
#1

[eluser]johnwbaxter[/eluser]
I've got a simple login form with the normal validation and error message areas like you'd expect.

But something odd is going on with retrieving flashdata.

Below is my controller code

Code:
$rules['username']    = "required|min_length[4]|max_length[32]|valid_email";
        $rules['password']    = "required|min_length[4]|max_length[32]|alpha_dash";        

        $this->validation->set_rules($rules);

        $fields['username'] = 'Username';
        $fields['password'] = 'Password';
        
        $this->validation->set_fields($fields);
        $this->validation->set_error_delimiters('<p class="error">', '</p>');                
        if ($this->validation->run() == false) {
            
            $flashdata = array('error' => true, 'error_text' => $this->validation->error_string);
            $this->session->set_flashdata($flashdata);
            $this->session->set_flashdata($_POST);
            
            $this->load->view('login_view', $data);
            
        } else {
            //Login to account
            if($this->simplelogin->login($this->input->post('username'), $this->input->post('password'))) {
                
                
                $flashdata = array('success' => true, 'success_text' => 'Login Successful!');
                $this->session->set_flashdata($flashdata);
                
                redirect('');    
            } else {
                
                
                $flashdata = array('error' => true, 'error_text' => 'There was a problem logging into the account.');
                $this->session->set_flashdata($flashdata);
                //$this->session->set_flashdata($_POST);
                
                $this->load->view('login_view', $data);            
            }            
        }

And this is how i show the error in my view:

Code:
&lt;?php echo $this->session->flashdata('error_text');?&gt;

And in my session record i have this:

Code:
a:4:{s:15:"flash:old:error";b:1;s:20:"flash:old:error_text";s:0:"";s:15:"flash:new:error";b:1;s:20:"flash:new:error_text";s:45:"There was a problem logging into the account.";}

When i put a username with the wrong password in and submit the form it doesn't log me in but it does simply reload the page with no error message displayed. However, the error message is in the sessions table. I don't understand why it is not showing in the view if it is in the sessions table. I know flashdata is working to some degree as if i try and submit the form again it comes back and shows the error.

Is it showing the cached html (browser cache not server i don't have caching on) for some reason?

I literally have no idea.


Messages In This Thread
Flashdata not being returned properly problem! - by El Forum - 11-06-2008, 03:48 PM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 03:10 AM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 03:28 AM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 03:57 AM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 03:59 AM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 04:02 AM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 04:06 AM
Flashdata not being returned properly problem! - by El Forum - 11-07-2008, 08:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB