Hi,
I have a file that should set some cookies, however I get the following error message..
Cannot add header information - headers already sent
What is usually the common cause for this, or how can it be fixed?
Many thanks, Ben
Blank spaces/lines in your PHP files... double check everything but especially look for blank lines after the closing ?> tag
That error means that some part of your code has already sent text or html to the client and therefore cannot send any headers. Make sure that if you are setting a cookie, you send it at the top of your code before you use a print or an echo.
hi,
Thanks guys, managed to fix it with your help! 😃
how come white space after a ?> messes up the headers?
Cheers
any whitespace after a ?> sends exactly that to the browser. A blank line. It'll show up in your resulting html just like that.