Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Damn headers 1

Status
Not open for further replies.

TyzA

Programmer
Jan 7, 2002
86
BE
For some reason I just keep on getting this error:
Warning: Cannot modify header information - headers already sent by (output started at C:\devtools\xampp\htdocs\pp\xlsreport.php:1) in C:\devtools\xampp\htdocs\pp\xlsreport.php on line 3


This is the piece of code causing this:
line 1:<?php
line 2:
line 3:header("Content-Type: application/vnd.ms-excel");
line 4:header("Expires: 0");

I've tried everything to fix this, but without any succes:
- checked all my white spaces
- maked sure these are the first statements of the php file
- tried using the output buffer
- ...

If any of you got an idea, thanks a million

-T
 
that's an easy one. your script does NOT start with line 1 being <?php there is something else in front of it. could be a line break, a space or ANYTHING ELSE AT ALL (even things like the doctype). you cannot send headers after any content at all has been sent to the browser.

take a good look at sleipnir214's debugging FAQ in this forum.
 
You're correct jpadie. There must have been something in front of my first line.
I've copied the code into a new file and it worked.

Tx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top