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!
Yes, but it's not related to spacing... it was specifically due to the setcookie causing the problem, which I did not know sent to the headers.. so I simply added @ before it.
setcookie does set headers, but does not send them the instant you use the function..
pre-pending with the 'at' symbol only suppresses any output generated by the function call, it wont stop it from setting headers (as that is it's purpose)...
As long as you call setcookie BEFORE sending any output you won't encounter the problem.
I have offered this advice in the past, so I will offer it again:
Do not shut up errors in your code, fix your code to not throw errors.
Headers already sent means you sent output to the browser before calling a function that sends response headers. Namely, session_start(), header() and setcookie(). Whenever you use these functions make sure to do so before ever sending any output or you will get headers already sent messages.
Making the error not squawk is not the same as fixing the error in your code. At least not in this case.