Jump to content

Email Forms


Captain825

Recommended Posts

Hi All,

 

Well I did it this time!  I agreed to create a website and I did; it turned out well...except that I have no idea how to get the information on the forms to be emailed to my email address.  I looked at some tutorials on php but they confused me even more.  Can anyone help me sort out the basic script I need to email the form?

 

Thanks

??? :-[

Link to comment
https://forums.phpfreaks.com/topic/115345-email-forms/
Share on other sites

This is the easiest way to do that:

<?php
if (isset($_POST['submit'])) {
   $body = print_r($_POST,true);
   $to = '[email protected]';
   $from = 'From: [email protected]';
   $subject = 'Form filled in';
   mail($to,$subject,$body,$from);
}
?>
<html>
<head>
<title>test form</title>
</head>
<body>
<form action="" method="post">

   all your form fields

<input type="submit" name="submit" value="Send">
</form>
</body>
</html>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/115345-email-forms/#findComment-593056
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.