note 97114 modified in function.header by johannes
| From: | johannes@php.net | Date: | Thu, 13 Dec 2012 10:06:57 +0000 |
| Subject: | note 97114 modified in function.header by johannes | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192508@lists.php.net to get a copy of this message | ||
Several times this one is asked on the net but an answer could not be found in the docs on php.net
...
If you want to redirect an user and tell him he will be redirected, e. g. "You will be
redirected in about 5 secs. If not, click here." you cannot use header( 'Location:
...' ) as you can't sent any output before the headers are sent.
So, either you have to use the HTML meta refresh thingy or you use the following:
<?php
header( "refresh:5;url=wherever.php" );
echo 'You\'ll be redirected in about 5 secs. If not, click <a
href="wherever.php">here</a>.';
?>
Hth someone
--was--
Several times this one is asked on the net but an answer could not be found in the docs on php.net
...
If you want to redirect an user and tell him he will be redirected, e. g. "You will be
redirected in about 5 secs. If not, click here." you cannot use header( 'Location:
...' ) as you can't sent any output before the headers are sent.
So, either you have to use the HTML meta refresh thingy or you use the following:
<?php
header( "refresh:5;url=wherever.php" );
echo 'You\'ll be redirected in about 5 secs. If not, click <a
href="wherever.php">here</a>.';
?>
Hth someone
http://php.net/manual/en/function.header.php