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,
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">
Use 'Radio Buttons' if you want your user to make one choice out of many (generally
I work from:
HTML Drop-down lists
Use 'select' if you want your user to make one choice from a drop-down list.
My age is:
HTML Check Boxes
Use 'checkbox' if you want your user to make multiple choices from a list of items.
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!