Welcome Guest, Not a member yet? Register   Sign In
Flashdata always seems one page behind
#1

[eluser]gabe[/eluser]
Hi there,

just started trying to use the flash. It seems that it is always 1 request behind. Consider the following code
Code:
$this->session->set_flashdata( 'flash', 'You have already provided us with your details' );
$this->load->view( 'competition_form' );

The flash message doesn't show the first time the view is loaded, only if refreshed. How can one get it to show in the view file?

I am actually trying to use it along with form validation and my full code looks like this:

Code:
if( $this->validation->run() == FALSE )
        {
            $this->session->set_flashdata( 'flash', 'Please fill in the form correctly…' );    
        }
        else
        {
            if( !$this->session->userdata( 'competition' ) )
            {
                $this->load->model( 'entry' );
                
                $this->entry->saveEntry();
                
                $this->session->set_userdata( 'competition', TRUE );
                
                $this->session->set_flashdata( 'flash', 'Thank you. Your details have been saved and a confirmation email sent.' );
            }    
            else
            {
                $this->session->set_flashdata( 'flash', 'You have already provided us with your details. Multiple submissions are not allowed.' );
            }
        }
        $this->load->view( 'competition_form' );


Messages In This Thread
Flashdata always seems one page behind - by El Forum - 02-27-2008, 08:44 AM
Flashdata always seems one page behind - by El Forum - 02-27-2008, 08:46 AM
Flashdata always seems one page behind - by El Forum - 02-27-2008, 08:53 AM
Flashdata always seems one page behind - by El Forum - 02-27-2008, 10:16 AM
Flashdata always seems one page behind - by El Forum - 02-27-2008, 10:19 AM
Flashdata always seems one page behind - by El Forum - 02-27-2008, 08:25 PM
Flashdata always seems one page behind - by El Forum - 02-28-2008, 03:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB