Help with header()

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
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Help with header()

Post by TonsOfFun »

I wanted a page to reload every 5 seconds so I added this code at the top

Code: Select all

header("Refresh :5;");
It worked fine on my computer but when I uploaded to the server, I got this error
[text]The server encountered an unexpected condition which prevented it from fulfilling the request.
The script did not produce correct headers. It must at least print out a Content-Type header, like so:
Content-Type: text/html

The header the script produced was:
Refresh :5;[/text]

So I tried

Code: Select all

header("Content-Type: text/html;");
header("Refresh :5;");
But it didn't work.

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

Re: Help with header()

Post by requinix »

a) No semicolon in the Content-Type unless you follow with more information (like a charset).
b) The Refresh HTTP header does not support timed refreshes. If your browser does then it's your browser that does.
TonsOfFun
Forum Commoner
Posts: 54
Joined: Wed Jun 02, 2010 7:37 pm

Re: Help with header()

Post by TonsOfFun »

tasairis wrote:a) No semicolon in the Content-Type unless you follow with more information (like a charset).
b) The Refresh HTTP header does not support timed refreshes. If your browser does then it's your browser that does.

Ok, thanks.

I took out the header refreash and used body onload and that worked.
Post Reply