I am looking to use this php mail handler to send an email to both my email address and the email address that is submitted through a web form by the user. It is successfully sending it to my email address (me@example.com), however, what I am having trouble with is also sending it to the email address that is input by the user. Any help is greatly appreciated!
<?php
if(isset($_POST['Submit'])){
$name=$_POST['name'];
$email=$_POST['email'];
$to='me@example.com';
$subject='Your 25% OFF discount code!';
$message="Email: ".$email."\n\n"."Name: ".$name."\n\n"."25% Discount Code: Discount25";
$headers='From: me@example.com';
if(mail($to, $subject, $message, $headers)){
header("Location:http://www.example.com/thankyou");
}
else{echo "Something went wrong!";}
}
?>