[nycphp-talk] automatic redirection of PHP script
David Krings
ramons at gmx.net
Tue Oct 23 06:43:57 EDT 2007
PaulCheung wrote:
> Hi
>
> I was wondering if anybody knows? I am sure that others must have
> encountered this in the past. What I am trying to accomplish is a
> conditional exit from the current script, go to and execute another
> script without any manual intervention. Using the following pseudo code,
> I am fully aware it is not elegant but it serves to explain what I want
> to accomplish.
>
> If $Cost < 100 goto and execute script-a.php
> else
> if $Cost > 1000 goto and execute script-b.php
> else
> carry on;
>
> Normally I would be happy to supply real PHP coding but unfortunately I
> do not know how to execute what I want to.
>
> Paul
You can use the HTML header redirect
header("location:http://www.myserver.gov/script-a.php");
and send the browser to a different script. That will work only if you haven't
sent output to the browser yet.
David
More information about the talk
mailing list