Not yet registered? Create a OverBlog!

Create my blog

Code for an HTML email form

In many cases, it can be useful to receive feedback from our web visitors. Common PHP or CGI applications can process data and produce edited reporting. However, in most cases, just a plain email is enough. HTML provides an easy way to send web forms data through this channel.

Generic form tags

Of course, first step is to define the input form itself. We will add the form part inside the body section of the HTML file: -FORM tag: needs opening and closing, it includes two attributes: ACTION: will define the URL for the data-processing file (PHP or CGI, for example). METHOD: Either "Get" or "Post"; email action will require usually POST method. - INPUT tag: To define each individual data entry. It includes two attributes, too: TYPE: it can be "text", "password", "radio" (button), "checkbox", "file", "submit", "reset"
NAME: an identification for later reporting and data management. - SELECT tag: for multiple choice selection (drop-down lists) - TEXTAREA: for special uses, where long input from the visitor is expected (comments, suggestions). Size can be defined in rows and columns.

Mail action

The action of sending the email will be defined at the URL position. Instead of "", the action tag will include something like "". The "post" parameter will include the data pairs (data name and value) in a text file, which will be the email contents. If you are skilled with PHP, you might add some programming, so that output is formatted. If you just want to send raw data, this is not needed (although basic PHP may improve usability) to produce mail forms.


The following example would define a basic structure for data input from the web visitor: FORM action=" method="post"
INPUT type="text" name="visitor_name"
INPUT type="password" name="thepass"
SELECT name="gender"
OPTION value="male"
OPTION value="female"
TEXTAREA name="feedback"
RESET form
FORM end Please check the images included in this article for "real" HTML code view. To create forms with specific layout and styling, some more HTML or CSS is required; web forms can be real simple - or as complicated as desired. IMPORTANT If you include a "file" input (to upload a CV, or maybe some cooking recipes) you have to include some filtering (even virus scan) to avoid the reception of malware - or just invalid data.

Same category articles Computers

A guide to buying a second hand laptop

A guide to buying a second hand laptop

This article will look at the dos and don'ts of buying second hand laptops. They can be a great way of getting newer technology whilst still making some great savings. There are certain rules which should be followed and positives and negatives of buying second hand that will be discussed in this article.
A guide to buying a high-end PC

A guide to buying a high-end PC

The average shop-bought computer is more than good enough for most people who use it to browse social networking sites, write the odd word processor document and view videos through an online catchup service. However, for a small segment of the population, only high performance and custom graphics workstation computers will be sufficient. This guide provides a guide to buying a high-end PC.
How to select replacement HP batteries for your laptop?

How to select replacement HP batteries for your laptop?

If your laptop battery is not lasting for as long as it did when you first bought your computer, it might be time to replace your battery. HP batteries can be replaced easily because they can be removed by the consumer himself. An HP replacement brand is available and there are also OEM batteries that are less expensive and seem to work as well.