Results 1 to 10 of 20

Thread: Day 12 - Sending Mail From PHP - Become PHP Expert in 30 days

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2009
    Posts
    76,596

    Default

    http://php.flashwebhost.com/sherly/mailform.php

    Code:
    <?php
    if (isset($_POST['submit'])) {
         $formEmail = $_POST['formEmail'];
        $body = $_POST['body'];
        mail('[email protected]', 'Message from Web Site', $body , 'From: ' . $fromEmail . "\n\r");  
         echo 'Thanks for Contacting us';
        } else {
    
    echo
    
    
    '<!doctype html>
    <html lang="en">
    <head>
     <meta charset = "UTF-8">
    <title> Contact Us </title>
    </head>
    
    
    <body>
    <form action= "mailform.php" method="POST">
         Email <br>
        <input type="text" name="fromEmail"> <br>
        Message <br>
         <textarea name="body" cols="30" rows="10"></textarea>
            <br>
            <button type="submit" name="submit" value="submit"> Send Mail </button>
     </form>
    </body>
    </html>';}
    Last edited by sherlyk; 06-04-2014 at 05:47 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •