Friday, June 11, 2010

PHP -Cannot modify header information - headers already sent by...

I know there are lot of articles regarding this issue but I thought that I would share my experience with you all since I spend considerable amount trying to fix that issue.

In PHP this error occurs mainly due to two reasons
  • If there exist white spaces  before any of the starting php tags prior to the place where you use  header(Location : ".....") function.  Here is an example.
note that the line I have marked in red shows the empty line before the start of
  •  Next, if we try to use header function inside html tags it will also not worked. Here is an example


 Here if you need to use the header function, you need to use it before line no 164.

No comments:

Post a Comment