note 74646 added to function.header
| From: | asaucier777 at mac dot com | Date: | Sat, 21 Apr 2007 15:25:09 +0000 |
| Subject: | note 74646 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125753@lists.php.net to get a copy of this message | ||
Refreshing/redirecting a/to a Page Using the "header" command in PHP.
I found the following code to help me refresh a page or really redirecting to a page after a certain
number of secionds. (I'm using php 5.x)
<?php
print(" <p align=\"center\"> User Not
Found</p><br><br>"); // err msg
header('Refresh: 3; url=index.html'); // waits 3 seconds & sends to homepage
?>
Explaination:
1. I used php to set up a simple html message as to what is happening
2. with header, there is a command, "Refresh" and here is how it works:
a. 'Refresh: 3; -- start all header commands with a single quote
b. Refresh requires a parameter that is in seconds which tells the browser
to refresh after this time period has passed.
c. The ; is necessary to separate it from the rest of the Refresh parameters
d. Refresh must be uppercased - I think
3. After the ; put the url= command and put in your desired web page
4. Location doesn't work! with in this context.
5. Order matters. Refresh first, then it's second parameter, url=
--Allen
----
Server IP: 69.147.83.197
Probable Submitter: 12.219.145.204
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/74646
Del: integrated -- https://master.php.net/note/delete/74646/integrated
Del: useless -- https://master.php.net/note/delete/74646/useless
Del: bad code -- https://master.php.net/note/delete/74646/bad+code
Del: spam -- https://master.php.net/note/delete/74646/spam
Del: non-english -- https://master.php.net/note/delete/74646/non-english
Del: in docs -- https://master.php.net/note/delete/74646/in+docs
Del: other reasons-- https://master.php.net/note/delete/74646
Reject -- https://master.php.net/note/reject/74646
Search -- https://master.php.net/manage/user-notes.php