Hi I asked this question a year ago but couldnt solve it and am now having another go.
link to the original question:
Send email to address from form input
I need to send the form data from my form to the specified address 'diysoakwells@hotmail.com' and also the email address from the form field which is assigned the variable $emaile. As it is the email arrives at diysoakwells@hotmail.com but not the variable address ($emaile). I cant understand why but it is definitely picking up the form data as it has all the details included in the email when I receive it at diysoakwells@hotmail.com. I basically want a copy of the order sent to the user as well as myself.
<?php
include_once("wsp_captcha.php");
if(WSP_CheckImageCode() != "OK") {
header('location:/form-rejected.php');
die();
}
$subject = 'Order Inquiry';
$jcitems = " <p><b>ORDER:</b></p><p> " . $_POST['jcitems']."<p/>" . "<p><b>Total:</b> $" . $_POST['jctotal']."</p>";
$time = date ("h:i A");
$date = date ("l, F jS, Y");
$headers = "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$headers .= 'From: inquiry@DIYSoakwells.com' . "
" .
'Reply-To: noreply@diysoakwells.com' . "
" .
'X-Mailer: PHP/' . phpversion();
$name = $_POST['name'];
$phone = $_POST['phone'];
$emaile = $_POST['emaile'];
$textbox = $_POST['textbox'];
$to = "diysoakwells@hotmail.com,$emaile";
$text = "<html><body><p>This form was submitted on Your Web Site on
$date at
$time</p><p><b>Message:</b>
$textbox</p><p><b>Customers Email Address:</b> $emaile</p><p><b>Customers Name:</b> $name </p><p><b>Customers Phone Number:</b> $phone </p></html></body>";
$body = $text . $jcitems;
mail($to, $subject, $body, $headers);
Header('Location: ../form-accepted.php');
?>
Please help if you can I will be monitoring this for the next few days. Open to suggestions/explanations!!!