Below is my code for a simple form but I want to make this form go to whatever email address is put in the $email field. Is this possible? I can not figure this out any help would be very appreciated.
<?php // declare our variables $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $contactnumber = nl2br($_POST['contactnumber']); // set a title for the message $subject = "WHATEVER HERE"; $body = "Thank you for filling out the form.Your Email: $email,
Your Number: \n\n$contactnumber"; $headers = 'From: ME'.$ME.'' . "\r\n" . 'Reply-To: '.$email.'' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); // I TYPICALLY PUT AN EMAIL ADDRESS HERE mail("[email protected]", $subject, $body, $headers); Above is what I am having problems with. I want this form to email it back to the email address input in the $email field. ?>
Thank you <?php echo $name ?>!