"headers already sent" madness

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • monomaniac21

    "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?

  • Oli Filth

    #2
    Re: "header s already sent" madness

    monomaniac21 said the following on 15/05/2006 12:30:[color=blue]
    > 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?[/color]

    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

    Comment

    • monomaniac21

      #3
      Re: &quot;header s already sent&quot; madness

      Cheers Oli i never knew that! It works!

      Oli Filth wrote:[color=blue]
      > monomaniac21 said the following on 15/05/2006 12:30:[color=green]
      > > 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?[/color]
      >
      > 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[/color]

      Comment

      Working...