Help with header function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vlio20
Forum Commoner
Posts: 26
Joined: Sat Jun 02, 2012 6:46 am

Help with header function

Post by vlio20 »

Hi,
I want to create a web page that when other page links to it, it links to it with some information

Code: Select all

(page.php?action=1)
.
The page needs to be refreshed every minute, so I used

Code: Select all

header("Refresh: 60;");
.
After the refresh I want that the path would be

Code: Select all

(page.php?action='')
, how can I do this???

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Help with header function

Post by requinix »

Refresh as a HTTP header isn't always obeyed (as it shouldn't because it's non-standard).

Code: Select all

<meta http-equiv="Refresh" content="60; url=page.php?action=''" />
vlio20
Forum Commoner
Posts: 26
Joined: Sat Jun 02, 2012 6:46 am

Re: Help with header function

Post by vlio20 »

Thanks
xtiano77
Forum Commoner
Posts: 72
Joined: Tue Sep 22, 2009 10:53 am
Location: Texas

Re: Help with header function

Post by xtiano77 »

You should consider using the JavaScript “setInterval()” function on your page. Check out the page below:
http://www.w3schools.com/js/js_timing.asp
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Help with header function

Post by requinix »

xtiano77 wrote:You should consider using the JavaScript “setInterval()” function on your page. Check out the page below:
http://www.w3schools.com/js/js_timing.asp
1. setTimeout() would be more appropriate.
2. It requires JavaScript while a <meta> does not.
3a. W3Schools is a horrible resource. Please don't point people there.
3b. For instance, that page says you "must" use a global variable for the handle returned by setTimeout() and setInterval().
3c. It also says the code will be executed after whatever amount of time. This is incorrect: the code will be queued up at that moment to be run at the next opportunity.
Post Reply