-1

I know before sending their should not be any printing statement on the screen. and I haven't did that in my code. Their is no echo statement no print statement.

warning Cannot modify header information - headers already sent by (output started at /home/oxfordmo/public_html/php/user/header.php:18) in /home/oxfordmo/public_html/php/user/index.php on line 21

Its showing error in header file.

Indexfile line 21

header("location:user.php?f=".base64_encode($_SESSION['firstname'])."&l=".base64_encode($_SESSION['lastname']));

and header file 15-20

<div id="wrapperheader">
  <div id="menu">
   <ul>
    <li class="active"><a href="">Company</a></li>
    <li><a href="">Services</a></li>
    <li><a href="">Gallery</a></li>
Aditii
  • 353
  • 1
  • 5
  • 15
  • Yes there is HTML output in line 18. You can not use the `header` function after HTML output has been created. – hakre Aug 26 '11 at 07:12

3 Answers3

3

Make sure you have no output before the header - this includes, but is not limited to, HTML output outside of the PHP block, output from includes you might do. Also check for unseen whitespace in includes after their closing ?> (many just leave them out for this exact reason).

ty812
  • 3,293
  • 19
  • 36
1

It seems like you're including that header.php file before sending the headers, that is, you have something like this:

include( header.php );
...
header( 'Location: ...' );

If this is the case, you have to move the header command to before including the file. Anything that outputs page content is not allowed before sending a header. That includes outputting "raw" HTML outside PHP tags (... ?> <html> <?php ...)

JJJ
  • 32,902
  • 20
  • 89
  • 102
1

Yes there is HTML output in line 18. You can not use the header function after HTML output has been created. That simple it is.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • thanks same problem what you mentioned. As I am wish to include header file in my each page, than I have to make div class of menus in each page. I can't use it single and include in all? – Aditii Aug 26 '11 at 07:59
  • Maybe you should open a new question for that, I don't see how this is related to the error message you had questions about. – hakre Aug 26 '11 at 08:13