• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to properly redirect user to other page upon login?


I'm new with CI. I'm still learning it, and hope to make my project with this framework. I have a simple question.

Before I started learning CI I was writing non OOP simple PHP apps, and used header("Location: ") to redirect the user upon successful or failed login. I've searched trough the docs and found redirect($uri = '', $method = 'auto', $code = NULL) function, does that do the same thing as far as I can see.

Should I still use the header() function or the CI built in redirect(), or should I use something different for this kind of task and similar tasks?

Thanks in advance!

Hi, Vita. You can use either one, going by your personal preference. The redirect() function itself uses the PHP header command, so even though it looks just like a GOTO, it's the only thing we can use even under OOP.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!

i think you have to use codeigniter built-in redirect() method because you are in learning stage of CI, so try to use built-in methods of CI

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.