<form name="form1" method="post" action="submit.php"> <label>Name <input name="name" type="text" id="name"> </label> <p> <label>Email <input name="email" type="text" id="email"> </label> </p> <p> <label>Message:<br> <textarea name="message" cols="50" rows="4" id="message"></textarea> </label> </p> <p> <center><label> <input type="submit" name="Submit" value="Submit"> </label> <label> <input type="reset" name="Submit2" value="Reset"> </label> </center> </p> </form>
I found some PHP code on a website which allows me to send what is inputted in the form to my email address and this is it below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <p> <?php $to="email removed for privacy reasons"; $subject="Mail from your website"; $from="FROM: ".$_POST['name']." <".$_POST['email'].">\n"; $message="This message is from the website. Name: ".$_POST['name']." Email: ".$_POST['email']." Message: ".$_POST['message']; //Now to actually send it mail($to, $subject, $message, $from); ?> </p> <p>Thank you for contacting us. We will get back to you within two business days.</p> </body> </html>
This code is working fine but it only sends me an email with what was inputted, I would also like the customer to be sent an email to tell them that I have received their query and will get back to them within two business days. Would you be able to tell me what code I would have to use for this? It would be going to the email that they have inputted and will be from my email with a subject of something like 'Thank you for contacting us' and then the message would be something like 'Thank you for contacting us. We will get back to you within two business days'
Thanks for any help you can give me