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 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); } 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. Link to comment https://forums.phpfreaks.com/topic/158332-redirect/#findComment-835048 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.