Re: header("Location:...") fails

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

 



On Wed, Jan 13, 2010 at 2:39 PM, Richard S. Crawford
<rscrawford@xxxxxxxxxxxx> wrote:
> Now, even if $numprojects is 1, 2, 3, etc., the header() command is not
> executed. Strangely, a header("Location") command later on in the script
> *is* executed. I've output the value of $numprojects, so I know that it's
> greater than 0, so the command
> header("Location:managebudget.php?e=1&pid=$pid"); *should* be executed...
> but it isn't. (Weirdly, if I put a die() command *after* this header()
> command, it works... but it seems pathologically inelegant to do so.)
>
> Obviously, I'm missing something incredibly basic. Can anyone help me figure
> this out?

It isn't "pathologically inelegant" at all. All the header function
does is output the header; it does not stop script execution. If you
don't stop the script yourself, it will continue to execute. You
probably want to send a message right after the header call anyway,
just in case someone is using a browser that does not handle
redirection.

Andrew

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux