[Techtalk] PHP to open a web page?

chris lists at semioticpixels.com
Sat Nov 13 05:55:17 EST 2004


Hi Megan,

If you need to redirect based upon some value, you can use php's header
function:
 http://us2.php.net/header) 

Example:
if $foo=="x" {
	header("Location: http://www.example.com");
	} else {
	header("Location: http://www.someotherplace.com"); }

OR, 
You might set a toggle 
For example
 $success = "1";
 //...do stuff
if ($success == "1")
    include("$was_successful");
  else
    include("$failure");	

In this case, $submitted and $failure are variables sent in hidden form
fields where the page name is defined: <input class="hidden" type="hidden"
name="failure" value="failure.php" />

Another common approach is to create a function (e.g. function
was_successful) and call it.

Hth
-chris hardy
http://www.semioticpixels.com




More information about the Techtalk mailing list