Reputation: 174
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>" ;
}
?>
Upvotes: 0
Views: 60
Reputation: 174
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
}
?>
Upvotes: 1