Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. if(isset($_POST['submit'])){
  4. $to = "elbiheiry2@gmail.com"; // this is your Email address
  5. $from = $_POST['email']; // this is the sender's Email address
  6. $first_name = $_POST['first_name'];
  7. $last_name = $_POST['last_name'];
  8. $subject = "Form submission";
  9. $subject2 = "Copy of your form submission";
  10. $message = $first_name . " " . $last_name . " wrote the following:" . "nn" . $_POST['message'];
  11. $message2 = "Here is a copy of your message " . $first_name . "nn" . $_POST['message'];
  12.  
  13. $headers = "From:" . $from;
  14. $headers2 = "From:" . $to;
  15. mail($to,$subject,$message,$headers);
  16. mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
  17. echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
  18. // You can also use header('Location: thank_you.php'); to redirect to another page.
  19. }
  20. ?>
  21.  
  22. <!DOCTYPE html>
  23. <head>
  24. <title>Form submission</title>
  25. </head>
  26. <body>
  27.  
  28. <form action="form.php" method="post">
  29. First Name: <input type="text" name="first_name"><br>
  30. Last Name: <input type="text" name="last_name"><br>
  31. Email: <input type="text" name="email"><br>
  32. Image: <input type="file" name="image_name"><br>
  33. <input type="submit" name="submit" value="Submit">
  34. </form>
  35.  
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement