Welcome Guest, Not a member yet? Register   Sign In
Session loses data
#1

[eluser]jwindhorst[/eluser]
I have a sinking feeling that there is something really dumb in my code and I just can't seem to find it! Arg.

Anyway, I have a form which posts requests. Once that gets processed, the application does a search in the system for things, and then proceeds to ask the user to verify that they want to send an email to their "associate" that they think might have what was requested.

The point is that I need to maintain posted data past a couple of forms. I'm storing the data objects in the session, and I can see them in there. Then I do a header redirect, and it's all gone!

Setting session data:
Code:
$this->load->library('ahrequest');
    if($add_res)              
    {
      $this->session->set_userdata('saved_requests', serialize($add_res));

      // print_r($this->session->userdata);

      $base_url=$this->config->site_url();
      $dest=$base_url . "request/confirm";

      redirect('request/confirm');    
      // header("Location: $dest");  
    }

After the redirect:
Code:
function confirm()
  {
    $this->load->library('ahrequest');

    $data['request_list']=$this->session->userdata('saved_request');
    echo "Check here";
    _pr($data['request_list']);

The commented out print_r statement in the first code block works just fine. In the second block however, I get nothing as though the session variable were never set!

Losing sleep over this one, please help!

Jeff
#2

[eluser]jwindhorst[/eluser]
There was a typo in the name of the variable I was storing my data.

My apologies to anyone that read the tyrade about the session timing thing, I found my own error and now the sleep() is no longer needed.




Theme © iAndrew 2016 - Forum software by © MyBB