Jump to content

Recommended Posts

Hi all,

I'm very much a PHP newbie, so please forgive my ignorance throughout the following post.

WHAT I WANT TO DO:

I want the contents of a rich online html form to be sent to my personal e-mail address. I've searched online for tutorials regarding this matter but only find scripts that process "simple contact" forms. If I have a form that has more fields than subject, email and message(e.g. address, phone number, etc...) how can I get the contents of such a form sent directly to my email address?

Hopefully, I'm making myself clear....

Thanks ahead of time any assistance you can offer.

Sincerely,

TuTwelve
Link to comment
https://forums.phpfreaks.com/topic/10550-rich-form-submission-via-sendmail/
Share on other sites

form.html
[code]<HTML>
    <head>
        <title>
            Form
        </title>
    </head>
    <body>
        <form action="mail.php" method="POST">
            <input name="name">
            <br><input name="email">
            <br><input name="phone">
            <br><input type="submit" value="Send!">
        </form>
    </body>
</HTML>[/code]
mail.php
[code]<?php
    $email = "your@email.adress";
    $subject = "Contact Form";
    $message = "Name: ".$_POST['name'];
    $message .= "\nEmail Adress: ".$_POST['email'];
    $message .= "\nTelephone: ".$_POST['phone'];
    $message = wordwrap($message, 70);
    mail($email, $subject, $message);
    echo("Thankyou for filling out the Form!");
?>[/code]
I hope this is what you wanted to do...

the email would look like:

Name: Bob
Email Adress: Bob@hotmail.com
Telephone: 0123 1234567
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.