Welcome Guest, Not a member yet? Register   Sign In
redirect not working

I'm a newbie to CodeIgnitor and I'm afraid this question might be a little naive. Nevertheless...

I have a form which correctly calls my email function in my controller which is called Coupon.

At the end of this function I want to redirect back to the index page. But it never does though I tried:






As added information coupon is configured as my default controller in routes.php.

I am pretty confused since my application so far is very simple and is basically a copy of the video tutorial.

Your help would be most appreciated. :-)


redirect() calls php's native header() function. It is IMPERATIVE that headers have not been sent already. In other words, make sure you are not sending any output before calling redirect.

Thanks for the help.

I don't have a view associated with this email method. In fact now I have the method doing _nothing_ except redirect and it is still not redirecting. And the page is completely blank, absolutely no HTML.

Doesn't mean there's not output higher up (can go all the way to index.php really.) Try checking for sent headers with headers_sent().

I'm an idiot. I forgot to load the URL helper. Thanks!

I'm surprised I didn't see any errors anywhere about my not loading the URL helper, i.e. the redirect method not being found.

[quote author="seonghuhn" date="1283938264"]I forgot to load the URL helper.[/quote]

Or that! Smile

Theme © iAndrew 2016 - Forum software by © MyBB