'Where i can add redirect page in php?
Hi in the below code I want to add a redirect page in both cases failed or success. Where do I need to put the code?
<?php
// (A) PROCESS ORDER FORM
if (isset($_POST["name"])) {
require "process.php";
echo $result == ""
? "<div class='msg'>Thank You! We have received your order</div>"
: "<div class='msg'>$result</div>" ;
}
?>
Solution 1:[1]
Here is an example of how someone can redirect to page.
<?php
// (A) PROCESS ORDER FORM
if (isset($_POST["name"])) {
require "process.php";
echo $result == ""
? header ("Location: success.php") // SUCCESS PAGE GOES HERE
: header ("Location: failed.php"); // FAILED PAGE GOES HERE
}
?>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user13926345 |