note 103619 modified in function.header by danbrown
| From: | danbrown@php.net | Date: | Fri, 22 Apr 2011 23:28:10 +0000 |
| Subject: | note 103619 modified in function.header by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179097@lists.php.net to get a copy of this message | ||
I wanted to redirect my page, after displaying a status result from feedback form submit click, to
the home page of the website. I tried displaying the status message for 'n' seconds,
before redirecting to the homepage, using the 'sleep()' function but I was stuck with the
header ("Location=$url") command, as it always returned the message "headers already
sent", after displaying the status message, and the page was stuck there.
using 'url' instead of 'location' along with the 'refresh' parameter,
instead of 'sleep()' function, worked for me in this case.
<?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>.';
?>
--was--
thanks marcel glacki,
I wanted to redirect my page, after displaying a status result from feedback form submit click, to
the home page of the website. I tried displaying the status message for 'n' seconds,
before redirecting to the homepage, using the 'sleep()' function but I was stuck with the
header ("Location=$url") command, as it always returned the message "headers already
sent", after displaying the status message, and the page was stuck there.
using 'url' instead of 'location' along with the 'refresh' parameter,
instead of 'sleep()' function, worked for me in this case.
<?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>.';
?>
http://php.net/manual/en/function.header.php