note 50085 added to function.header

From: Date: Thu, 17 Feb 2005 15:36:27 +0000
Subject: note 50085 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-85167@lists.php.net to get a copy of this message
when redirecting to another page <? header(Location: file.php); ?> you must make sure you put the header function before all output..otherwise you'll end up with an error such as: 'Warning: Cannot modify header information - headers already sent by' however this causes great inconvenience, a quick work around is to use javascript to allow you to redirect to any page from anywhere in your script no matter if output has already started, by using: <? echo "<script> self.location(\"file.php\");</script>"; ?> ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50085 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50085&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50085&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50085&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50085&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50085&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50085&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85167) next »