RE: header()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Probably I missed a message, so forgive me if I did.

If what the code below wants is to redirect to a different page, then I
believe that the HEADER command can not be preceeded by an ECHO.

    echo "<br>".$ReturnTo;
    header("Location: $ReturnTo");

It won't work after that, and that is clear on the docs.
Remove the echo and force a new call to the same URL.

Luis

-----Original Message-----
From: Alf Stockton [mailto:alf@xxxxxxxxxxxxxx] 
Sent: quarta-feira, 4 de Outubro de 2006 13:44
To: php-windows@xxxxxxxxxxxxx
Subject: Re:  header()

Niel Archer wrote:
> Hi Alf
>
>   
>> Is this the correct method to use in Windows?
>>     
>
> No, it's not the correct method on ANY platform.  Before asking a
> question on these lists, it's wise to check the documentation first.
>
>   
>> Note: HTTP/1.1 requires an absolute URI as argument to Location:
including the scheme, hostname and absolute path, but some clients accept
relative URIs.
>>     
I have copied the code almost verbatim out of the manual and it still
does not work.
/* Redirect to a different page in the current directory that was
requested */
    $host  = $_SERVER['HTTP_HOST'];
    $uri  = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
    $extra = 'index.shtml';
    $ReturnTo = sprintf("http://%s%s/%s";, $host, $uri, $extra);
    echo "<br>".$ReturnTo;
    header("Location: $ReturnTo");
    exit;

and when I cut and paste the line produced by the echo into the, can I
call it "go box", at the top of the screen and press enter it goes where
I want?

-- 
Regards,
Alf Stockton		www.stockton.co.za
 
Your sister swims out to meet troop ships.
My email disclaimer is available at www.stockton.co.za/disclaimer.html

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux