1. "contact.php" contains the form. All form data is then passed to "mail.php" using POST
2. "mail.php" fixes the data then runs a simple test. If the email was successful it sends $sendername to "sent.php" using GET
3. "sent.php" recieves the file then prints $sendername out in a simple message like "Thank you $sendername" or something. View code below:
Code: Select all
<?php
//Inside "mail.php" which sends $sendername using GET after recieving it using POST
if(mail($agiemail, $subject, $message, $header))
{
$sendername = $_POST['fName']; //fName is "John Doe" for example
header("Location: http://mydomain.com/sent.php?sendername=$sendername ");
}
else
{
//sent to an error message
}
?>Code: Select all
//The appended URL suddenly became: http://www.mydomain.com/sent.php?sendername=John%2520Doe
$name = $_GET['sendername'];
echo $name //Prints out "John%20Doe" instead of "John Doe"