I understand this question has been asked before and people answer with things like header(Location: "link.html");
which is great! but I don't know where to put it and believe me, I've tried!
Basically, I have a very simple PHP code that is designed to send information that has been inputted into a form. The code is as below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>
<body>
<?php
$to='myemail@address.com';
$subject='email subject line';
$qanswer=$_POST['qanswer'];
$FirstName=$_POST['FirstName'];
$Surname=$_POST['Surname'];
$CustomerEmail=$_POST['CustomerEmail'];
$CustomerTelephone=$_POST['CustomerTelephone'];
$PickupLocation=$_POST['PickupLocation'];
$AddressLine1=$_POST['AddressLine1'];
$AddressLine2=$_POST['AddressLine2'];
$TownCity=$_POST['TownCity'];
$County=$_POST['County'];
$Postcode=$_POST['Postcode'];
$Destination=$_POST['Destination'];
$PickupDate=$_POST['PickupDate'];
$PickupTime=$_POST['PickupTime'];
$message="FirstName: ".$FirstName. "\r\n" . "Surname: ".$Surname. "\r\n" . "CustomerEmail: ".$CustomerEmail. "\r\n" . "CustomerTelephone: ".$CustomerTelephone. "\r\n" . "PickupLocation: ".$PickupLocation. "\r\n" . "AddressLine1: ".$AddressLine1. "\r\n" . "AddressLine2: ".$AddressLine2. "\r\n" . "TownCity: ".$TownCity. "\r\n" . "County: ".$County. "\r\n" . "Postcode: ".$Postcode. "\r\n" . "Destination: ".$Destination. "\r\n" . "PickupDate: ".$PickupDate. "\r\n" . "PickupTime: ".$PickupTime;
if ($qanswer==10)
{
mail($to,$subject,$message);
echo 'Thank You! Someone will be in contact shortly to confirm your booking';
}
else
{
echo 'Your booking failed to send! Please ensure you answered the anti-spam question correctly';
}
?>
</body>
</html>
What I would like to do is when the form has been sent successfully, rather than displaying a blank page with the text "Thank You! Someone will be in contact shortly to confirm your booking" I would like to to redirect to a page called "thankyoupage.html" that is located in the same directory. Likewise, if it fails, I'd like it to redirect to a page called "formsendfailure.html".