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

Problem with PHP output

P: n/a
Hello,
I have an html menu that I renamed menu.php. I then have a download
program which uses an index.php file. I did the standard <?php
include("menu.php"); ?command and I see the menu. However, it messes
up the php index file. When I go to download a file it just opens the
file on the screen for some reason rather than showing a popup window
asking where to put the downloaded file. I then tried to just add the
html code into the index.php file and that didn't work either. When I
take out the <?php include("menu.php"); ?command the script works
perfect. I then tried another download script and it puts the menu on
the screen, but the php file that runs after the menu is not centered
and looks bad. Does anyone know what the problem could be? Is it
something with my .htaccess file?
Any help would be appreciated.
Jul 23 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Sun, 22 Jul 2007 18:25:31 -0700, John
<Jo*********@nnnnnnnnn.nowherewrote:

I'm also getting this.
Cannot modify header information - headers already sent by (output
Jul 23 '07 #2

P: n/a
John wrote:
On Sun, 22 Jul 2007 18:25:31 -0700, John
<Jo*********@nnnnnnnnn.nowherewrote:

I'm also getting this.
Cannot modify header information - headers already sent by (output
Sorry, my crystal ball is broken. Without seeing the code it would be
impossible to determine which of the thousands of possible errors you
could be making.

But you might try searching on the error message - it could be very
illuminating. And if you still can't figure it out, try posting the
failing code here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 23 '07 #3

P: n/a
Jerry Stuckle wrote:
John wrote:
>On Sun, 22 Jul 2007 18:25:31 -0700, John
<Jo*********@nnnnnnnnn.nowherewrote:

I'm also getting this.
Cannot modify header information - headers already sent by (output

Sorry, my crystal ball is broken. Without seeing the code it would be
impossible to determine which of the thousands of possible errors you
could be making.

But you might try searching on the error message - it could be very
illuminating. And if you still can't figure it out, try posting the
failing code here.
I used to get that one a LOT. For me - it was almost always because I
was trying to set a cookie or otherwise add an HTTP header AFTER I had
already sent the output buffer to the client.
Jul 23 '07 #4

P: n/a
>I used to get that one a LOT. For me - it was almost always because I
was trying to set a cookie or otherwise add an HTTP header AFTER I had
already sent the output buffer to the client.


Here is the error.

PHP Warning: Cannot modify header information - headers already sent
by (output started at /home/etc.
How do I fix this?

Jul 23 '07 #5

P: n/a
..oO(John)
>Here is the error.

PHP Warning: Cannot modify header information - headers already sent
by (output started at /home/etc.
How do I fix this?
This issue comes up often enough and is answered often enough! You
should learn how to use Google Groups to search through the archives.

In short: You're sending something to the browser already (could be a
space, a newline, something like that), so no further headers can be
sent. The error message usually tells you where the output started.

Micha
Jul 23 '07 #6

P: n/a
>In short: You're sending something to the browser already (could be a
space, a newline, something like that), so no further headers can be
sent. The error message usually tells you where the output started.

Micha

Can you have this <?php include("menu.php"); ?>

and then start another php file <?php

whatever code

?>
Or how is the best way to call the menu.php file inside of the php
file that I want to run?

Jul 23 '07 #7

P: n/a
..oO(John)
>>In short: You're sending something to the browser already (could be a
space, a newline, something like that), so no further headers can be
sent. The error message usually tells you where the output started.

Can you have this <?php include("menu.php"); ?>

and then start another php file <?php

whatever code

?>
Whatever you like. You just can't output anything in the script that
starts the file download.

Micha
Jul 23 '07 #8

P: n/a
Message-ID: <6k********************************@4ax.comfrom John
contained the following:
>I have an html menu that I renamed menu.php. I then have a download
program which uses an index.php file. I did the standard <?php
include("menu.php"); ?command and I see the menu. However, it messes
up the php index file. When I go to download a file it just opens the
file on the screen for some reason rather than showing a popup window
asking where to put the downloaded file.
Your download program worKs by sending out headers which tell the
browser what to expect. Generating any other output before these
headers are sent will cause PHP to send other headers which you don't
see and then html output. Once this has started you cannot then send
headers again and hence the error message.

In short, you can't include the me
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 23 '07 #9

P: n/a
Message-ID: <v1********************************@4ax.comfrom Geoff
Berrow contained the following:
>In short, you can't include the me
nu.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 23 '07 #10

P: n/a
>In short, you can't include the menu

Thanks for the reply and detailed answer.

That will help me move forward.

Jul 23 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.