marmite Posted April 18, 2007 Share Posted April 18, 2007 Hi, The below code does not redirect: does anyone know why? if ($_SESSION['prevpage']) { #echo "session"; header("Location: http://localhost/index.php"); exit; } Thanks Link to comment https://forums.phpfreaks.com/topic/47604-headerlocation-not-working/ Share on other sites More sharing options...
marcus Posted April 18, 2007 Share Posted April 18, 2007 The session isn't set then Try echoing off the session before trying to locate somewheres else. Link to comment https://forums.phpfreaks.com/topic/47604-headerlocation-not-working/#findComment-232408 Share on other sites More sharing options...
marmite Posted April 18, 2007 Author Share Posted April 18, 2007 Sorry, I don't follow you. This code: if ($_SESSION['prevpage']) { echo "session"; header("Location: http://localhost/index.php"); exit; } does echo "session", so $_SESSION is set. What do you mean, "echo off the session"? (sorry, I'm new to this!) Link to comment https://forums.phpfreaks.com/topic/47604-headerlocation-not-working/#findComment-232542 Share on other sites More sharing options...
boo_lolly Posted April 18, 2007 Share Posted April 18, 2007 you can't echo anything to the browser before you call the header function... http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/47604-headerlocation-not-working/#findComment-232544 Share on other sites More sharing options...
marmite Posted April 18, 2007 Author Share Posted April 18, 2007 Thanks! Solved! Link to comment https://forums.phpfreaks.com/topic/47604-headerlocation-not-working/#findComment-232555 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.