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 "http://www.myweb.com/process.cgi", the action tag will include something like "mailto:myname@myweb.com". 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.

Example

The following example would define a basic structure for data input from the web visitor: FORM action="mailto:myname@myweb.com 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"
SUBMIT form
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

Where to buy PCI Express graphics cards

Where to buy pci express graphics cards

Pci express graphics cards are an integral part of most modern computers. for anyone who is serious about gaming, photo or video editing, then the use of such a card can be very beneficial. this article shall be looking at where to buy pci express graphics cards.
How do Dell power supplies work?

How do dell power supplies work?

A dell power supply ensures that your computer has power and is working properly. the power supply gives you the ability to power on your computer. the dell power supply is one of the most essential parts of a computer, because without it, your computer would not work at all. this article will show you what a power supply is and how they work.
How to set up a multi-user website

How to set up a multi-user website

Web developers need to be aware of setting up multi-user websites that allow many users to sign up at a time and to create independent websites or web applications on their own. various web applications offer powerful, easy-to-use interfaces to set up multi-user websites. this article provides a guide to setting up a multi-user website.
MS PowerPoint tips and advice

Ms powerpoint tips and advice

Whether we are required to do presentations at work or at schools, professional powerpoint templates help in delivering a visual presentation of your work. it not only adds value but also shows professionalism as well as depicts that you have understood the said topic of discussion. it is from these simple computer tips such as using powerpoint that will enable you to make a lasting impression on your audience. this article provides some ms powerpoint tips and advice.