note 74646 deleted from function.header by danbrown
| From: | danbrown@php.net | Date: | Sun, 07 Dec 2008 18:15:58 +0000 |
| Subject: | note 74646 deleted from function.header by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147817@lists.php.net to get a copy of this message | ||
Note Submitter: asaucier777 at mac dot com
----
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