..hi guys .. how can I combine 'header' with a timer to redirect a page after a set time expires? has anyone done anything like this?
ta - Fari
timed redirect to another URL
Moderator: General Moderators
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
do you want to redirect the page after the page has fully loaded? if so, you can't. the php script as finished executing by that time and therefore has no control over the current function of the page (ie. refreshing). you can use the the meta tag to achive this kinda thing.
<meta http-equiv="refresh" content="value [; URL]" />
where value is the number of seconds to wait before refresh and URL, if specified, is the page to refresh to and if not specified, refreshes the current page.
<meta http-equiv="refresh" content="value [; URL]" />
where value is the number of seconds to wait before refresh and URL, if specified, is the page to refresh to and if not specified, refreshes the current page.
header() refresh/redirect with delay.
header() refresh/re-direct without delay
Code: Select all
<?php header("refresh: 5; url=http://$SERVER_NAME/page.php"); ?>Code: Select all
<?php header("Location: http://$SERVER_NAME/page.php"); ?>