Re: How to make program execution go to another file?

From: Date: Fri, 21 May 2004 15:09:38 +0000
Subject: Re: How to make program execution go to another file?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186686@lists.php.net to get a copy of this message
Thank you for your help. This should do nicely. Michael Vail, Warren wrote:
This is a common problem for people coming from other languages where the file structures are the same as the execution structure. A few of at least 50 answers is as follows; Force the browser to invoke your next program; If(1==a) { header("Location: this.php");
     exit;  //stop this script
} If(1==b) {
     header("Location: that.php");
exit; } If(1==c) { header("Location: other.php"); } Another option would be to take advantage of conditional includes to bring the code into the current script; If(1==a) { include("this.php"); exit; } If(1==b) { include("that.php"); exit; } If(1==c) { include("other.php"); } Include will issue a warning if executed and the file does not exist. Require is fatal if executed and the file does not exist. You can, of course use; if(file_exists("this.php")) include("this.php"); to suppress any warning at all. Warren Vail -----Original Message----- From: michael young [mailto:mhyoung@valdosta.edu] Sent: Thursday, May 20, 2004 2:12 PM To: php-general@lists.php.net Subject: [PHP] How to make program execution go to another file? Hi,
      I want program execution to go to one of several other files based on a decision.
For Example. if (1==a) go to this .php file if (1==b) go to that .php file if (1==c) go to the other .php file Thank you for your time. Michael


« previous php.general (#186686) next »