Welcome Guest, Not a member yet? Register   Sign In
set_value() with redirect() issue
#9

[eluser]boltsabre[/eluser]
Using "redirect" actually "loads" the new .php script, thus closing the old one - you're not extending a class, using "include/require" to load the .php script into your existing script or anything like that. As such, any variables instantiated in your first .php script are lost/deleted from memory - that's why you cannot access them, they no longer exist! If you want to keep them you need to hold them in memory by some storage mechanism (ie, cookies, sessions, DB)

Why do you even want to redirect if validation fails? Surely you just want to reload the same "view" and display your validation errors right? In that case, instead of doing a redirect, just load your view again

Code:
if ($this->form_validation->run() === true)
{
   redirect('good_job');
}
else
{
   //Stay in same page and print errors there
  $this->load->view('your_login_view_name', $data);
}


Messages In This Thread
set_value() with redirect() issue - by El Forum - 05-14-2012, 05:40 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 05:45 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 05:47 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 05:51 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 06:30 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 06:31 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 06:34 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 07:19 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 08:20 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 08:41 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 08:42 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 08:50 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 09:16 AM
set_value() with redirect() issue - by El Forum - 05-14-2012, 09:19 AM
set_value() with redirect() issue - by El Forum - 02-08-2013, 12:47 PM
set_value() with redirect() issue - by El Forum - 02-08-2013, 01:29 PM
set_value() with redirect() issue - by El Forum - 02-08-2013, 02:41 PM
set_value() with redirect() issue - by El Forum - 02-08-2013, 05:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB