-3

Possible Duplicate:
Headers already sent by PHP

I inherited this website, taxquest.com, from another developer and the Webform is giving me an error about headers that I am not familiar with: Warning: Cannot modify header information - headers already sent by (output started at /home/taxquest/public_html/includes/header.php:27) in /home/taxquest/public_html/mailer2.php on line 11

The form sends the email correctly but then goes into a redirect loop.

Any help here would be greatly appreciated.

Sincerely, Roger

Community
  • 1
  • 1
  • Do you have any other errors/notices/echoes coming before you set the `header()`? The `header()` should be sent before anything is outputted. – tftd Jun 25 '12 at 00:53

4 Answers4

2

You need to have your header() statements before anything is outputted, this includes whitespace. Some documents like documents saved in ANSI will sometimes put whitespace in the very beginning of your document. Try opening it with different encoding (like UTF-8) if the code I'll add with this post isn't helping you out.

Wrong:

<html>
    <head>
    <title><?="Example"; ?></title>
    </head>
    <?php
    header("location: ../");
    ?>

Right:

<?php
header("location: ../");
?>
    <html>
    <head>
    <title>Example</title>
    </head>
Jason Sturges
  • 15,855
  • 14
  • 59
  • 80
Nict
  • 3,066
  • 5
  • 26
  • 41
  • Sorry for the delay on this. I went ahead and did a complete redesign of the site and resolved the issue that way. Sorry for the duplicate question. – user1478735 Jan 11 '13 at 19:40
1

Sometimes unwanted/extra whitespace/new lines at the end of the php files lead to this error. Try removing them if they exist. Specifically in header.php at line 27.

If they dont exist, you probably are trying to modify/set new header parameters in the case where the page has already been sent to the browser. This answer can be more specific if you can post some code.

exception
  • 955
  • 2
  • 11
  • 23
0

Warning: Cannot modify header information - headers already sent by (output started at /home/taxquest/public_html/includes/header.php:27) in /home/taxquest/public_html/mailer2.php on line 11

This is because you have headers in both files. (session_start or something) You may try to include header.php after mailer2.php and remove these lines from header if unnecessary.

And: There should be no output before your headers. (Sorry for my english.)

Mustafa
  • 825
  • 3
  • 14
  • 37
0

Your header() function should be before HTML Tags.

napstyr maceda
  • 179
  • 3
  • 13