Re: header()

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

 



Alf Stockton wrote:
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?

What *exactly* do you mean by "does not work"? What does it do?

Do you have display_errors on in your php.ini? If not then chances are that you have output something before calling the header() function in which case it probably won't work. However, because the default PHP configuration does not display errors you will not be told about it. There are a lot of notes on the manual page for header (http://php.net/header) about this issue, the reasons for it and how to resolve it.

Also, FYI, requesting a read receipt when sending to a public, non-commercial mailing list is generally considered bad manners.

-Stut

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