HTML Forms
Forms are the primary method for gathering data from site
visitors.
HTML forms are used to pass data to a server
Create a form with-<form>---------</form>
HTML Forms Attribute:
1) Name -define name of the form.
Eg. <form name=”myinform” method=”get”></form>
2) method -Establishes how the form’s data will be sent to
the processing agent.
Form controls:
1) Fieldsets:
The <fieldset> tag is used to group related elements in a form.
The <fieldset> tag draws a box around the related elements.
<legend> tag is nested within <fieldset> tag to give the name to the
block.
2) Textbox-
Ordinary textbox:-
<input type=”text”>-defines a one-line input field that a user can enter
text information.
Password Textbox:-
<input type=”password”>-Encrypt text that a user can enter text
information.
3) Radio Button-
<input type=”radio”>- Defines a radio button using radio button user can
select only one of a limited number of choices.
4) Checkbox:- <input type=”checkbox”>- Defines a checkbox using
checkbox user can select zero or more of a limited number of
choices.
5) SelectList:-
The <select> element is used to create a drop-down list.
The <option> tags inside the <select> element define the available
options in the list.
Attribute for selectlist:-
1) Size:- attribute to specify the number of visible values.
2) Multiple:- attribute to allow the user to select more then one
value.
To create the student registration form .
6) Textarea:-
The <textarea> tag defines a multi-line text input control.
A text area can hold an unlimited number of characters and the text.
The size of a text area can be specified by the cols and rows attribute.
7) Button:-
To <input> tag defines button input control.
To create normal button.
<input type=”button” value=”SUBMIT” >
To create reset button.eg-
<input type=”reset” value=”CLEAR” name=”reset”>
8) Placeholder - The placeholder attribute adds a hint to an input or
textarea element.
9) Lable -
<label>Creates a label or brief description before input
elements