Jump to content

Archived

This topic is now archived and is closed to further replies.

tutwelve

RICH FORM SUBMISSION VIA SENDMAIL

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.