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 Quote Link to comment 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. Quote Link to comment 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!) Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
marmite Posted April 18, 2007 Author Share Posted April 18, 2007 Thanks! Solved! Quote Link to comment 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.