469,923 Members | 1,631 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

"headers already sent" madness

Hi all!

How can i get round this. I want to stick an include at the top of my
script for the connection to DB and then somewhere below this process a
form and if all is good execute a redirect using the header() function.
However I get the headers already sent error. So ive had to type in the
connection details on the actual page which isnt something that i want
to keep doing for every page that has a redirect (i like using them a
lot).

Is there some sort of work-around?

May 15 '06 #1
2 1224
monomaniac21 said the following on 15/05/2006 12:30:
Hi all!

How can i get round this. I want to stick an include at the top of my
script for the connection to DB and then somewhere below this process a
form and if all is good execute a redirect using the header() function.
However I get the headers already sent error. So ive had to type in the
connection details on the actual page which isnt something that i want
to keep doing for every page that has a redirect (i like using them a
lot).

Is there some sort of work-around?


Yes. Make sure all your include()-d files do not output *anything* to
the browser, including any whitespace (or any other characters) outside
of <?php ... ?>.
--
Oli
May 15 '06 #2
Cheers Oli i never knew that! It works!

Oli Filth wrote:
monomaniac21 said the following on 15/05/2006 12:30:
Hi all!

How can i get round this. I want to stick an include at the top of my
script for the connection to DB and then somewhere below this process a
form and if all is good execute a redirect using the header() function.
However I get the headers already sent error. So ive had to type in the
connection details on the actual page which isnt something that i want
to keep doing for every page that has a redirect (i like using them a
lot).

Is there some sort of work-around?


Yes. Make sure all your include()-d files do not output *anything* to
the browser, including any whitespace (or any other characters) outside
of <?php ... ?>.
--
Oli


May 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jerry | last post: by
4 posts views Thread by Q | last post: by
10 posts views Thread by Luke Meyers | last post: by
reply views Thread by phpCodeHead | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.