Professional Documents
Culture Documents
HTML Forms
HTML Forms
• HTML Forms are required when you want to collect some data from the
site visitor. For example during user registration you would like to collect
information such as name, email address, credit card, etc.
• The HTML <form> element defines a form that is used to collect user
input.
• The <form> element is a container for different types of input elements,
such as: text fields, checkboxes, radio buttons, submit buttons, etc.
– <form action=“Home.php" method="post">
– ...
– </form>
• The most common attribute of <form> are action and method.
• The action attribute contains the URL to which information included
within the form will be sent for processing by the server.
• The method attribute is the HTTP method browsers should use to
submit the form data.
• Both action and method attributes are related to submitting and
processing data.
The HTML <form> Elements
• The HTML <form> element can contain one or more of the
following form elements:
The <input> Element
• The HTML <input> element is the most used form element.
• An <input> element can be displayed in many ways, depending
on the type attribute.
The <label> Element
• The <label> tag defines a label for many form elements.
Following is the list of elements that support label elements
• The <label> element is useful for screen-
reader users, because the screen-reader will
read out loud the label when the user focus on
the input element.