Welcome Guest, Not a member yet? Register   Sign In
Passing a variable on redirect
#5

[eluser]The Revel[/eluser]
Ok, I managed to do it this way:

In the top part, I added the value to the session data:

Code:
//redirect them to the login page
            $this->session->set_userdata('searchcode', $this->input->post('searchcode', true));
            
   redirect('auth/search_scancode/', 'refresh');

So that when it redirects it checks for the post variable, if it doesn;t exist grab it from the session, and then delete the session:

Code:
if ($this->input->post('searchcode', true))
         {
          $searchcode = $this->input->post('searchcode', true);  
         }
          else
          {
            $searchcode = $this->session->userdata('searchcode');
            $this->session->unset_userdata('searchcode');
          }

This seems to work ok.


Messages In This Thread
Passing a variable on redirect - by El Forum - 05-04-2012, 12:05 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 12:06 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 12:08 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 12:22 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 12:55 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 01:15 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 02:36 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 02:40 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 02:48 PM
Passing a variable on redirect - by El Forum - 05-04-2012, 03:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB