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:[EMAIL PROTECTED]
Sent: Thursday, May 20, 2004 2:12 PM
To: [EMAIL PROTECTED]
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php