Welcome Guest, Not a member yet? Register   Sign In
Need to post twice to display flashdata message.
#6

[eluser]TheFuzzy0ne[/eluser]
Flashdata is set, and then retrieved on the request after. Generally, you'll see flashdata being set just before a redirect is made, and then the data is pulled from the flashdata variable after.

Here's a quick example (untested):

./system/application/controllers/test.php
Code:
class Test extends Controller
{
    function Test()
    {
        parent::Controller();
    }

    function index()
    {
        # We're going to set the flashdata
        $this->session->set_flashdata('message', 'This is our flash data message');

        # This isn't available right until the next request, so let's force the browser
        # to redirect to the next_method.
        redirect('test/next_method');
    }

    function next_method()
    {
        # Now we can retreive the flash data.
        echo $this->session->flashdata('message');
    }
}

I'd also like to point out that using $_SESSION is not a good idea when using CodeIgniter's session class. You'll probably encounter a lot of problems.

Hopefully this helps.


Messages In This Thread
Need to post twice to display flashdata message. - by El Forum - 05-01-2009, 03:55 PM
Need to post twice to display flashdata message. - by El Forum - 05-01-2009, 07:53 PM
Need to post twice to display flashdata message. - by El Forum - 05-02-2009, 03:02 AM
Need to post twice to display flashdata message. - by El Forum - 05-02-2009, 03:37 AM
Need to post twice to display flashdata message. - by El Forum - 05-02-2009, 08:30 AM
Need to post twice to display flashdata message. - by El Forum - 05-02-2009, 10:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB