you have your form go to another page- on that page you capture the data from the input names
like so
(this page is one I use to capture checkboxes and put them into the email- just remove that)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Email</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php
$firstname=trim($firstname);
$lastname=trim($lastname);
$email=trim($email);
$phone=trim($phone);
if (empty($firstname))
{
echo "Please go back and enter your first name, this is a required feild";
exit;
}
if (empty($lastname))
{
echo "Please go back and enter your last name, this is a required feild";
exit;
}
if (!eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
{
echo "You have entered an invalid email address. Please return to the previous page and try again.";
exit;
}
$toaddress = "contact@domain.com";
$from = "this@domain.com";
$mailcontent = "Customer name: ".$firstname . $lastname."\n"
."Customer email: ".$email."\n"
."Customers order: ". implode(", ",$_POST['books']) . "\r\n";
mail($toaddress, $mailcontent, $from);
?>
</head>
<body>
Thank you, your mail has been sent.
</body>
</html>
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..