Created
February 15, 2019 15:24
-
-
Save JacobLett/9ab3e1a55bbce5d0ee221544349cba40 to your computer and use it in GitHub Desktop.
php email form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if($_POST["submit"]) { | |
| $toEmail=$_POST["toEmail"]; | |
| $fromEmail=$_POST["fromEmail"]; | |
| $subject=$_POST["subject"]; | |
| $message=$_POST["message"]; | |
| $mailBody="From: $fromEmail\nTo: $toEmail\n\n$message"; | |
| mail($toEmail, $subject, $mailBody, "From: $fromEmail <$fromEmail>"); | |
| $thankYou="<p>Thank you! Your message has been sent.</p>"; | |
| } | |
| ?> | |
| <?=$thankYou ?> | |
| <form method="post" action="/test/"> | |
| <label>To email:</label> | |
| <input name="toEmail"> | |
| <label>From email:</label> | |
| <input name="fromEmail" value=""> | |
| <label>Subject:</label> | |
| <input name="subject"> | |
| <label>Message:</label> | |
| <textarea rows="5" cols="20" name="message"></textarea> | |
| <input type="submit" name="submit"> | |
| </form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment