Hi all,

I believe the questions was "after the php file did some processing".

It depends on whether PHP has sent anything to the browser.  If you've done
an echo for example, or sent your <!DOCTYPE... or <HTML> and <HEAD> tags, a
header() redirect won't work.  You'll get an error like "headers already
sent to the browser" or simular.

So this code would work:

<?
$foo = 1;

if($foo)
    {
    header("Location: xxx.php");
    }
else
    {
?>
<HTML>
    <HEAD>
    </HEAD>
    <BODY>
    Something
    </BODY>
</HTML>
<?
    }
?>


But this code would not

<HTML>
    <HEAD>
    </HEAD>
    <BODY>
    <?
    $foo = 1;
    if($foo)
        {
        header("Location: xxx.php");
        }
    else
        {
        echo "something";
        }
    ?>
    </BODY>
</HTML>

... because output has been sent to the browser already.


So, if you've already sent output to the browser, you'll need to look at
<META> refresh, or JavaScript, or better still, review your code to work
within these contraints.

You can also look at output buffers, which have been discussed on this list
many times, and should be easy to search for.


Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------
 



on 09/04/02 12:10 AM, Rénald CASAGRAUDE ([EMAIL PROTECTED]) wrote:

> 
> Le lundi 8 avril 2002, à 04:00 PM, Wo Chang a écrit :
> 
>> What is the best way to do redirect after a
>> php file did some processing?
> 
> Function header() ???
> 
> R.
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to