I have seen this question alot recently. Maybe it is time for an FAQ. Maybe 
somebody
else would like to have an attempt at wording this better:

Q: (7.15?) I want to use the "header" function to do something like a 
redirect, but I keep
            getting messages about the headers having already been sent.

A:  The headers are sent to the browser just before the first piece of content
     is sent. Content is
        a) Any text generated by a PHP output function ( such as "print" or 
"echo" )
        b) Any text before, after or between the "<?php ... ?>" blocks.

     The usual reason to get this error message, when you would swear blind 
you
     aren't outputting anything yet, is white space before outside of the code
     blocks. Eg:

       <?php require("user_logging.inc") ?>

       <?php header ("Content-Type: audio/x-pn-realaudio"); ?>
       // Broken, Note the blank lines above will be treated as
       // content and cause the headers to be sent

     If you changed the above code to

       <?php
             require("user_logging.inc");
             header ("Content-Type: audio/x-pn-realaudio");
       ?>

     and still got the error, then that probably means extra white-space
     somewhere in "user_logging.inc"




At 07:30 25/07/2001 -0600, Nelson Goforth wrote:
>This seems simple, but for some reason I can't find what I'm looking for 
>in books or the archive.  Might just be looking for the wrong words.
>
>I just want to open another page, sending some parameters, at a point in a 
>script - without the user clicking on anything (I can do this in a form - 
>I want to do it WITHOUT the form).
>
>Like:    if($test) {
>               GO_TO_PAGE (http://www.site.dom/page.php?id=838383);
>          }
>
>Except with code that actually works, of course.
>
>I tried "header (Location:...)" but got an error message that I can't add 
>to the headers.
>
>What have I missed?
>
>Thanks,
>Nelson
>--
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to