By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

Error:Cannot modify header information - headers already sent

100+
P: 254
Hi
I am working on gd library with PHP to create graphs which is displaying correctly. But I want to display some information about this graph as text which will not be part of this graph means image or I want to print this graph in a table. but while doing this I got this error

Cannot modify header information- header already sent.

So how can I do this. If code is needed I will provide.
Feb 6 '08 #1
Share this Question
Share on Google+
5 Replies


Markus
Expert 5K+
P: 6,050
Hi
I am working on gd library with PHP to create graphs which is displaying correctly. But I want to display some information about this graph as text which will not be part of this graph means image or I want to print this graph in a table. but while doing this I got this error

Cannot modify header information- header already sent.

So how can I do this. If code is needed I will provide.
It means you've already had output from the script, so the headers cannot be sent.

And yes: code is needed.
Feb 6 '08 #2

100+
P: 254
It means you've already had output from the script, so the headers cannot be sent.

And yes: code is needed.
Ok I am giving you the code which I am using and I want to display this image inside a table

Expand|Select|Wrap|Line Numbers
  1. //php code
  2.  
  3. $image=imagecreate(200,200);
  4. imagecolorallocate($image,150,200,30)
  5. header("Content-Type image/png");
  6. imagepng($image);
  7.  
I want this image should come in the table.
Feb 6 '08 #3

P: 10
Hello

I am also facing the same problem this the error message i am getting.

Warning: Cannot modify header information - headers already sent by (output started at header.php:96) in my.class.php on line 1198


What is happening over here is that i when i am trying to download an attached file i am passing the additional header information which is conflicting with the header info which has already being sent before.

Please help on how can i send this header info along with the one passed already.

I checked for all the whitespaces in the header file etc and removed it.
Feb 6 '08 #4

Markus
Expert 5K+
P: 6,050
Ok I am giving you the code which I am using and I want to display this image inside a table

Expand|Select|Wrap|Line Numbers
  1. //php code
  2.  
  3. $image=imagecreate(200,200);
  4. imagecolorallocate($image,150,200,30)
  5. header("Content-Type image/png");
  6. imagepng($image);
  7.  
I want this image should come in the table.
Can you move lines 3 & 4 to after the header?

(i'm not experienced with headers...)
Feb 6 '08 #5

100+
P: 254
Hello

I am also facing the same problem this the error message i am getting.

Warning: Cannot modify header information - headers already sent by (output started at header.php:96) in my.class.php on line 1198


What is happening over here is that i when i am trying to download an attached file i am passing the additional header information which is conflicting with the header info which has already being sent before.

Please help on how can i send this header info along with the one passed already.

I checked for all the whitespaces in the header file etc and removed it.
Might be you will get your solution at this url:

http://in2.php.net/header

go through this url carefully.
Feb 7 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.