×

Html & Html5

The World's best Software Development Study Portal

HTML Form


If we want to take the details of our site visitor than we use HTML forms. IT includes controls such as text fields , passwords fields, radio buttons, checkbox , options etc. in which our visitor can fill up its own details and these details we can submit to our servers to save those details.
For example:- We can take the example of facebook where at the time of signing up we just have to submit some sort of details or we just fill the form in which we submit our name , password or etc.
     Than as soon as we submit those details it just went to the server where our data been stored and whenever we put that specific username and password than our facebook id restores.



HTML Form Syntax :- <form action="server url" method="get|post"> //input controls here like textfield , checkbox etc.// <form>





Some more Form tags and Description



Tag

Description
<form> It defines an HTML form to enter inputs by the used side.
<input> It defines an input control.
<textarea> It defines a multi-line input control.
<label> It defines a label for an input element.
<fieldset> It groups the related element in a form.
<legend> It defines a caption for a
element.
<select> It defines a drop-down list.
<optgroup> It defines a group of related options in a drop-down list.
<option> It defines an option in a drop-down list.
<button> It defines a clickable button.


HTML <input> element


If we want to create form fields where we want our visitor to fill his details or we can say if we are providing any box or the area wherethe details will submit by the user is done through <input> tag. So it generally creates a box or field. There are several types of <input> tag.
Let's understand them one by one :-



text input

It generally defines a normal input text field, where normal name , username etc. we can ask.

Let's understand this by the following example :-



Output of this Program



First name :

Middle name :

Last name :



password input

It generally defines a sensitive information which we don't want to share and also it is not visible to user.

Let's understand this by the following example :-



Output of this Program



Password :



e-mail field input

It generally defines a correct email address of user. It must use @ and .

Let's understand this by the following example :-



Output of this Program



E-mail id: :



radio button input

It generally use to select any one option from the multiple one. Maybe it can use for selection of gender, quiz competition etc.

Let's understand this by the following example :-



Output of this Program



Male Female



checkbox control input

It generally use to check multiple options from the given option , means user can select as much he wants.

Let's understand this by the following example :-



Output of this Program



Choose only Colors :

Red
Blue
Green
Banana
White



submit button input
It generally submits all the information which is been added by the user to the server, where than all the details been saved.

Let's understand this by the following example :-



Output of this Program



Username :

Password :