Welcome Guest, Not a member yet? Register   Sign In
why doesn't this work
#1

[eluser]Unknown[/eluser]
trying to get a mental grip on how flashdata works.

with this controller (session loaded by autoload.php):
Code:
<?php

class Flashtest extends CI_Controller {
    function __construct() {
        parent::__construct();
    }
  
    public function index() {
        $this->session->set_flashdata('message', 'session data set');
        $this->load->view('view_flashtest');
    }
}

and this view
Code:
<html>
<head><title>flashtest</title></head>
<body>
    <div>
    ============================<br/>
&lt;?php echo $this->session->flashdata('message'); ?&gt;<br/>
    ============================<br/>
&lt;/body&gt;
&lt;/html&gt;

I don't get the message displayed until I refresh the page.
Why? Shouldn't the flashdata display when the view loads (without a page refresh)?




Theme © iAndrew 2016 - Forum software by © MyBB