Welcome Guest, Not a member yet? Register   Sign In
How to properly redirect user to other page upon login?
#1

(This post was last modified: 09-08-2015, 09:39 AM by Vita.)

Hi,

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!
Reply
#2

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!
Reply
#3

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB