redirect not working |
[eluser]seonghuhn[/eluser]
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: redirect('coupon'); redirect('coupon/'); redirect('coupon/index'); redirect('coupon/index/'); redirect('/'); 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. :-) Thanks, Frank
[eluser]bretticus[/eluser]
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.
[eluser]seonghuhn[/eluser]
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.
[eluser]bretticus[/eluser]
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().
[eluser]seonghuhn[/eluser]
I'm an idiot. I forgot to load the URL helper. Thanks!
[eluser]seonghuhn[/eluser]
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.
[eluser]bretticus[/eluser]
[quote author="seonghuhn" date="1283938264"]I forgot to load the URL helper.[/quote] Or that! |
Welcome Guest, Not a member yet? Register Sign In |