sudsy1970 Posted July 2, 2010 Share Posted July 2, 2010 Hi all, I have managed to create a working logon/logout script for my website however i am getting the following message when i try to redirect to the page i want Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Cosford\template.php:63) in C:\xampp\htdocs\Cosford\customer_login.php on line 40 i have heard that this can often be because of whitespace for which i have checked and cannot see. don't really undersatnd why it is mentioning my template file at all ?? Anyone got any ideas please ? [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/206555-redirecting-once-logged-in/ Share on other sites More sharing options...
Cagecrawler Posted July 2, 2010 Share Posted July 2, 2010 It's not just whitespace that sends the headers, it's any content. Your template.php (which is the first thing to be executed since it is included at the top of customer_login.php) contains html which is sent to the browser before the headers are sent. You need to turn on output buffering by including ob_start() as the first thing to happen (ie. before you include template.php). Read up on ob_start and the other output control functions for a better understanding. Link to comment https://forums.phpfreaks.com/topic/206555-redirecting-once-logged-in/#findComment-1080421 Share on other sites More sharing options...
sudsy1970 Posted July 2, 2010 Author Share Posted July 2, 2010 brilliant thank you very much Link to comment https://forums.phpfreaks.com/topic/206555-redirecting-once-logged-in/#findComment-1080422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.