PHP header already sent error
Few days ago I made a silly mistake in my php coding. I have echoed something on the page where I have set the cookie. It seems that it is not faulty code. I googled the problem and found the solution from php.net. Actually cookie must be called before anything goes to browser from server.
So If you echo anything or show anything before setting the cookie, the page will say that cannot modify header. Header already sent by…….. or something like this.
Another silly mistake many of my friend made is that they paste some code before the session_start() function. This should not be done.
Tags:header already sent error, header error, header problem, PHP
