Results 1 to 8 of 8

Thread: Email form please?

  1. #1
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Email form please?

    I need an email form where the user can specify the email address the message is sent to, who it's sent from and the email subject?

    Is this possible? If so, how? Thank you.

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    all that but no message?

    Code:
    <form name="something" action="/somewhere.php" method="post">
    <p>
        <label>To:</label>
        <input type="text" name="recipient" value="">
    </p>
    <p>
        <label>From:</label>
        <input type="text" name="from" value="">
    </p>
    <p>
        <label>Subject:</label>
        <input type="text" name="subject" value="">
    </p>
    </form>

  3. #3
    Join Date
    Jul 2007
    Location
    England
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Oh yeah, and a message field please?

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Code:
    <form name="something" action="/somewhere.php" method="post">
    <p>
        <label>To:</label>
        <input type="text" name="recipient" value="">
    </p>
    <p>
        <label>From:</label>
        <input type="text" name="from" value="">
    </p>
    <p>
        <label>Subject:</label>
        <input type="text" name="subject" value="">
    </p>
    <p>
        <label>Message:</label>
        <textarea name="message" cols="20" rows="5"></textarea>
    </p>
    <p>
        <input type="submit" name="submitBtn" value="Send Email">
    </p>
    </form>
    change the cols value to the number of columns (width) you would like the box to appear on screen
    change the rows value to the number of rows (height) you want the box to appear on screen

    all that above is the html portion, that will only be what the user sees, you need another page, which in this form i have dubbed "somewhere.php" that will process the values and send the email. Check with your ISP (Website Host) to see if they support php... chances are they do, but some hosts don't allow it

    if your host doesnt allow it... find out what type of mailing system they do support and let us know.

    if you want to add any additional 1 line fields, just use the convention below
    Code:
    <p>
        <label>NAME_OF_FIELD</label>
        <input type="text" name="NAME_OF_FIELD" value="">
    </p>
    to add a multiple line text field like the message, use
    Code:
    <p>
        <label>NAME_OF_FIELD</label>
        <textarea name="NAME_OF_FIELD" cols="20" rows="5"></textarea>
    </p>

  5. #5
    Join Date
    May 2008
    Location
    San Diego, CA
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I wrote a script a couple weeks ago that will do all of these things for you. It generates the html of the form, the javascript to validate it, and the php to send it. Assuming you have access to an editor it should be pretty easy for you. http://www.designforjoe.com/tester.php

  6. #6
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by inn8 View Post
    I wrote a script a couple weeks ago that will do all of these things for you. It generates the html of the form, the javascript to validate it, and the php to send it. Assuming you have access to an editor it should be pretty easy for you. http://www.designforjoe.com/tester.php
    i see a couple errors:
    <form action="mail_form.php" method="post"> onSubmit " var the_result="checkMandatory(); return the_result;"
    ...
    <label for "email" ="Email: ">

    also the javascript validation is good, but if javascript is disabled, they could send as many blank emails as they wanted. try php validation too. if you fix some of the more malignant errors, it could be very useful.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  7. #7
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by Master_script_maker View Post
    i see a couple errors:
    <form action="mail_form.php" method="post"> onSubmit " var the_result="checkMandatory(); return the_result;"
    ...
    <label for "email" ="Email: ">

    also the javascript validation is good, but if javascript is disabled, they could send as many blank emails as they wanted. try php validation too. if you fix some of the more malignant errors, it could be very useful.
    or better yet, use javascript to validate on the server side in real time (AJAX) that way you do not need to replicate your validation script in both php and javascript

  8. #8
    Join Date
    May 2008
    Location
    San Diego, CA
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default E-mail form

    Thanks for the advice on the form script - I will fix the noted bugs. I'll work up a server-side validation for it as well, although it will be a bit lenghtier.

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
  •