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
- 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.
- Create a web page using the basic HTML skeleton above:
- 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.
- 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.
- Hit {Enter} after the <body> tag.
- On the resulting line, type the code above, replacing the email address with the email address to which you wish the form sent.
- Hit {Enter} twice and type </form> just before the closing </html> tag.
- 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.
- To create any question, type it in the web document under the <form> tag on its own line. For instance, the code above would display that question on the page.
- To create a radio button, type the code:
- 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.
- Additional radio buttons have to have a different name.
- Checkboxes work in the same manner, but the code uses the type="checkbox" instead.
- A text box displays a box into which a user may type an open ended answer. The code looks like the example above:
- 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.
- Type the code to create a drop-down box from which users may select from a number of options.
- The selected="selected" attribute means that this option appears selected as the default value when the page loads.
- Type the 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.
- 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.
- 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.
- Browse to the file you created and hit OK to open the web form.
- Test by selecting some buttons and clicking on Send to send the form answers.
- 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.
Tips
- Multitask to make your work easier: open instances of your text processor, browser, and email programs and switch between them.
- To get back to your document to edit it in a text processor, remember that the text file has a different extension, and so will not appear if you list files of type *.txt. Choose to list All Files to see the files with an *.htm or *.html ending.
Warnings
- E-mail is not encrypted so this is not suitable for collecting confidential information (such as health or credit card information). Fortunately, many reputable services exist to help you collect such information.
- Web pages are text documents saved with an *.htm or *.html ending. Not saving with this ending may confuse the browser which may not render your page properly.
Things You'll Need
- A text editor, e.g. Notepad.
- A web browser, such as Mozilla Firefox.
- A computer configured with a working mail client for testing purposes.
Related Articles
- Search for File Conversion Software
- Print Blocked Images
- Bypass Sonicwall to Watch YouTube
- Create a City or Town on Your Computer
- Create HTML Forms