Contact form.How to send email straight?

Discussion in 'HTML & Website Design' started by Igozorus, Jul 28, 2013.

  1. #1
    Hello.I have contact form.Here is the code
    <header>
    <h1>Contact me</h1>
    </header>
    <section>
    <p>You can write your comments about our website or you can submit your own potato recipe to us!</p>
    <form method="post" action="mailto:">
    <label for="nm">Name: </label>
    <input type="text" id="nm">
    <label for="em">Email: </label>
    <input type="text" id="em">
    <label for="comm">Your comments: </label>
    <textarea id="comm"></textarea>
    <br>
    <input type="submit" value="Send email">
    </form>

    </section>

    When i write message in Your comments field and press submit,then email client opens a tab to write a new message.But i don't want that.I want that message would be sent straight,just when person write in "Your comments" field and press submit.
    So,i can't do that just with html?
    Can you write me the easiest and fastest way to do that?Better with javascript,but if it is not possible then with php.
    Can you write the whole code here?
    Thank you.
     
    Igozorus, Jul 28, 2013 IP
  2. kidpunky83

    kidpunky83 Active Member

    Messages:
    127
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    Digital Goods:
    1
    #2
    it is not possible just with html :) you need php to process the request, there are plenty of free php contact form tutorials out there
     
    kidpunky83, Jul 28, 2013 IP
  3. Igozorus

    Igozorus Greenhorn

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #3
    It's just i'm not started learning php yet,so i thought maybe someone can write me a code
     
    Igozorus, Jul 28, 2013 IP
  4. ezinepoint

    ezinepoint Greenhorn

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    <?php $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $formcontent="From: $name \n Message: $message";
    $recipient = "";
    $subject = "Contact Form";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!";
    ?>
     
    ezinepoint, Jul 28, 2013 IP
  5. Igozorus

    Igozorus Greenhorn

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #5
    Ok,can you tell,how the whole code will look?I don't know where insert it.Should i first create form.php
    and then do code like this:
    <form>
    <few input types and button>
    <?php $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $formcontent="From: $name \n Message: $message";
    $recipient = "";
    $subject = "Contact Form";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!";
    ?>
    </form>
     
    Igozorus, Jul 29, 2013 IP