dreamwest Posted May 15, 2009 Share Posted May 15, 2009 Im tryinf to go back to pages from where i enter login.php $come_from = $_SERVER['HTTP_REFERER']; if ($come_from == "site.com/login.php"){ $redirect_url = "http://site.com"; }else{ $redirect_url = javascript:history.go(-2); redirect($redirect_url) } I realize javascript shouldnt be there cause it giving an error Parse error: syntax error, unexpected ':' in /home/j Quote Link to comment https://forums.phpfreaks.com/topic/158332-redirect/ Share on other sites More sharing options...
neogemima Posted May 15, 2009 Share Posted May 15, 2009 You are missing a semicolon in your script, use this: $come_from = $_SERVER['HTTP_REFERER']; if ($come_from == "site.com/login.php"){ $redirect_url = "http://site.com"; }else{ $redirect_url = javascript:history.go(-2); redirect($redirect_url); } Quote Link to comment https://forums.phpfreaks.com/topic/158332-redirect/#findComment-835040 Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 Also, $redirect_url = javascript:history.go(-2); is not PHP. You need to put that in quotes. Quote Link to comment https://forums.phpfreaks.com/topic/158332-redirect/#findComment-835048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.