Welcome Guest, Not a member yet? Register   Sign In
redirect doesn't work after echo statements
#1

[eluser]max123[/eluser]
I want to know why redirect function doesn't work after echo statements.

I have some echo statements inside my controller to display javascript alerts.

Code:
echo "[removed]alert('Please login as a Job Seeker');[removed]";


after that line there is a redirect command. But it doesn't work when echo statement is there above. How can I do both the things without removing the alert or the redirect command
#2

[eluser]adamp1[/eluser]
You cannot output text to the page and then do a redirct. The reason being is the redirct is done using server headers.

If you do want the JS message to display before they get redircted I suggest you do a redirct using JS after your alert message has shown.
#3

[eluser]max123[/eluser]
That means this way

window_location = "controller/function"

is it? _ is for the dot
#4

[eluser]max123[/eluser]
Hey tokyo. redirect doesn't work when there are echo statements above the redirect function. That was my problem




Theme © iAndrew 2016 - Forum software by © MyBB