Page 1 of 1

Help with header()

Posted: Thu Sep 09, 2010 7:41 pm
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?

Re: Help with header()

Posted: Thu Sep 09, 2010 10:38 pm
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.

Re: Help with header()

Posted: Fri Sep 10, 2010 7:41 pm
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.