Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Tuesday, January 12, 2016

Redirect doesn't works, it does nothing

Username/password is incorrect.


Click here to try again
"; } }else{ ?>

Log in

Answer by Robert Verhaegen for Redirect doesn't works, it does nothing


yes, everything works, if i put submit, it works, but doesn't redirect me, it stays on the same page. if i put echo "example" it show example...

Answer by Ajay Makwana for Redirect doesn't works, it does nothing


Use full url in header location from i.e. header("Location: httP://yoursite.com/welkom.php"); that will work.

Answer by GeoffAtkins for Redirect doesn't works, it does nothing


You can't use header("Location: welkom.php"); where you are because headers have already been sent.

Either load all of the HTML in the page before that into a variable and then echo it once your code has come to that condition, or turn on Output Buffering.

Alternatively, re-order your code to check this condition and redirect before you send anything to the browser.

Answer by Raphioly-San for Redirect doesn't works, it does nothing


If anything, make sure there is no output whatsoever before or after the location header and put a die() after it.... Your sessions_start() should also not work, because you already have output before the statement...

So your session start and your location header should preceed the HTML.

Take a look at what I changed:

                          Login                            

Username/password is incorrect.


Click here to try again
"; }else{ ?>

Log in

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.