shergold Posted July 13, 2009 Share Posted July 13, 2009 Hello, i was wondering if there is a way to output text before i send the header, for example the same effect as the following ("location: /page.php"); echo "You are now being redirected to the login page."; any solutions will be greatly appriciated, thanks shergold. Quote Link to comment https://forums.phpfreaks.com/topic/165824-solved-echo-before-header/ Share on other sites More sharing options...
aggrav8d Posted July 13, 2009 Share Posted July 13, 2009 No. location: <new loc> will not work if you echo first. Try instead a javascript command to redirect after a short delay, such as the one seen here: http://www.tizag.com/javascriptT/javascriptredirect.php Quote Link to comment https://forums.phpfreaks.com/topic/165824-solved-echo-before-header/#findComment-874652 Share on other sites More sharing options...
phporcaffeine Posted July 13, 2009 Share Posted July 13, 2009 Absolutely not .... by sending text you are in effect, sending a header to the browser. Sending subsequent headers is not possible. Some alternatives maybe to use some creativity with iFrames. Quote Link to comment https://forums.phpfreaks.com/topic/165824-solved-echo-before-header/#findComment-874654 Share on other sites More sharing options...
shergold Posted July 13, 2009 Author Share Posted July 13, 2009 ok thanksallot for both of your replies, ill use javascript for redirect. Thanks again, shergold. Quote Link to comment https://forums.phpfreaks.com/topic/165824-solved-echo-before-header/#findComment-874655 Share on other sites More sharing options...
HERATHEIM Posted July 13, 2009 Share Posted July 13, 2009 Another way: <META HTTP-EQUIV="refresh" content="0;URL= YOURLIN "> 0 = second to delay Quote Link to comment https://forums.phpfreaks.com/topic/165824-solved-echo-before-header/#findComment-874656 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.