Wednesday, February 26, 2014

How to Create a Form in HTML That Can Be Submitted to an Email Address

Using basic tools--a text editor, browser, and email client--you can create a basic form that sends information you request to an email address. This method employs basic form elements and requires no special programs on a web server.

This may work fine in a controlled, internal business environment. However, remember that this method is of limited usefulness as Internet users shift from desktop mail clients to webmail services such as Gmail. Your visitors will also receive security warnings when trying to submit forms this way. There exist many free or paid services that do allow you to collect form information from visitors who choose to use webmail.

Steps

  1. 1
    Open a blank text editor session (e.g. Notepad under Windows) or if you have access to a web page editing tool, create a basic web page.

    281925 1.jpg
  2. 281925 2.jpg
    2
    Create a web page using the basic HTML skeleton:
    <html>
    <head>
    <title>Insert Your Title Here</title>
    </head>
    <body>
    </body>
    </html>
    
  3. 281925 3.jpg
    3
    Enter each of these tags on a separate line, except for the <title> and </title> tags, which can go on the same line. Web pages do not require this formatting, but it does make reading web documents easier for mortal humans.
  4. 281925 4.jpg
    4
    In between the <title> and </title> tags, insert the name of this page or project, e.g. the information you intend that the page requests.
  5. 281925 5.jpg
    5
    Hit {Enter} after the <body> tag.
  6. 281925 6.jpg
    6
    On the resulting line, type the following code, replacing the email address with the email address to which you wish the form sent:
          <form action="MAILTO:user@emailserver.ext" method="GET" enctype="text/plain">
    
  7. 281925 7.jpg
    7
    Hit {Enter} twice and type </form> just before the closing </html> tag.
  8. 281925 8.jpg
    8
    To start your form elements, decide whether you would like to use radio buttons (only one clickable response from a list of choices), checkboxes (multiple responses from a list), dropdown list boxes, or a text box.
  9. 281925 9.jpg
    9
    To create any question, type it in the web document under the <form> tag on its own line. For instance,
    <p> 1. What is your favorite vacation spot?</p>
    
    would display that question on the page.
  10. 281925 10.jpg
    10
    To create a radio button, type
    <input type="radio" name="1" value="The Scottish Highlands"> The Scottish Highlands
    
  11. 281925 11.jpg
    11
    The type tells the browser to display a radio button. The name of all related buttons must share a name. All radio buttons named "1" are mutually exclusive, that is, users can select only one from the group. The value will be passed to the email message, and the text after the <input...> tag gets displayed by the browser. Create more radio buttons for all related responses.
  12. 281925 12.jpg
    12
    Additional radio buttons have to have a different name.
  13. 281925 13.jpg
    13
    Checkboxes work in the same manner, but the code uses the type="checkbox" instead. E.g.
    <input type="checkbox" name="2" value="Antarctica" /> Where there be penguins.
    Checkboxes are not mutually exclusive, i.e. you may select every member of a checkbox group.
    
  14. 281925 14.jpg
    14
    A text box displays a box into which a user may type an open ended answer. The code looks like:
    <input type="text" name="3" size="100">
    
  15. 281925 15.jpg
    15
    The size may be adjusted to enlarge the box, and represents the number of characters that should fit in the box based on the base font of the web page.
  16. 281925 16.jpg
    16
    Type the following code to create a drop-down box from which users may select from a number of options:
    <select name="vacation_spots">
    <option value="Choose one:" selected="selected">Choose one:</option>
    <option value="Manunka Chunk, NJ">Manunka Chunk, NJ</option>
    <option value="Arthur's Seat">Arthur's Seat, Edinburgh, Scotland</option>
    <option value="Cicely, AK">Cicely, AK</option>
    </select>
    
  17. 281925 17.jpg
    17
    The selected="selected" attribute means that this option appears selected as the default value when the page loads.
  18. 281925 18.jpg
    18
    Type the following two lines at the bottom of the document just above the </form> tag to place buttons in your document that will send or reset the form:
    <input type="submit" value="Send">
    <input type="reset" value="Reset">
    
  19. 281925 19.jpg
    19
    Choose File, Save As in your text processor, give your document a filename, and add the extension .htm or .html to the end of this filename so that web browsers will recognize this document as a web page.
  20. 20
    Preview your page by opening it in a web browser. In Firefox, for example, go to File, Open File, or hit Ctrl-O or Command-O to open a new document.

    281925 20.jpg
  21. 281925 21.jpg
    21
    Browse to the file you created and hit OK to open the web form.
  22. 22
    Test by selecting some buttons and clicking on Send to send the form answers.

    281925 22.jpg
  23. 281925 23.jpg
    23
    When a user clicks Send, the user responses will appear in a new mail message with the name and value written in the body of the message.

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Hot Sonakshi Sinha, Car Price in India