Web Tutorial Plus

HTML Forms

HTML Forms (or web forms) are used to collect the data from users. These are an important and integral part of all modern websites for two way communication. By providing forms to your webpage, you get input from the user for various purposes like storing the information in a database, check user's credential, do some financial transaction, send emails, etc.

HTML Forms have the ability to collect the information from user's browser, however, for processing this information you need some server side programming. We will cover that in details in our tutorials on ASP.NET. As of now, we will focus on how to create the form for interaction with users and will not get into much detail.

A form consists of input elements like text fields, textarea, checkboxes, radio-buttons, select lists, submit buttons, etc. The input elements are placed inside <form> and </form> tags.

Input Element - HTML Forms

Input elements are used to gather the information and are most important elements of HTML forms.
We use various types of input elements for ease of gathering data. Let's create our first webpage with a form now.

HTML Forms Example

Attribute 'type' determines the type of input field (like textbox, radio button, checkbox, etc.).
Name attribute is unique identification for any input. Other useful attributes are 'value', 'size', 'readonly' and 'maxlength'.


Password Field - HTML Form

Password fields are defined with <input type="password">

Browser Output

Full Name:
Password:

Radio Buttons

Use 'Radio Buttons' if you want your user to make one choice out of many (generally max. 4-5).

Browser Output

I work from:
Office
Home
Both

HTML Drop-down lists

Use 'select' if you want your user to make one choice from a drop-down list.

Browser Output

My age is:

HTML Check Boxes

Use 'checkbox' if you want your user to make multiple choices from a list of items.

Browser Output

I Like: Reading Playing Singing Traveling

We are not discussing more input elements here. This is due to the fact that ASP.NET which we will learn later has different codes for these elements. Practically, HTML forms, without background programming is of no use. Just wait for the real excitement with forms with ASP.NET lessons.

With this, we end our intermediate tutorial on HTML!
Leave a comment Leave a Comment....

Name*:
Email*:
[Your email will not be published.]
Website: [Include http://]
Answer This: 13 + 6 = [Anti-Bot]
Stalin Stalin 26 Jul 2012
Usefull HTML Tutorial For Me Thanks Friend
Daliborko Daliborko 31 Dec 2012
An excellent tutorial. I'm glad that people like to share knowledge with others.Excellent.
Gunjesh Kumar Gunjesh Kumar 31 Dec 2012
Thanks Daliborko. And please let me know if you require any help.
XianAer XianAer 10 Jan 2013
Thank you!!!!! I'm a grad student trying to pick up coding on my own--this helps a lot!!!
© 2013 Web Tutorial Plus