What Is an HTML Form?

An HTML form is one of the most common ways to gather information from a Web client. It is made up of two basic parts: the <form> tag and the <input> tags. Both of these elements are described below.

The <form> Tag

The <form> tag is what defines the form. It tells the HTML browser how to display the form and how the browser should submit the form. The basic syntax of an HTML <form> tag is listed below:

<form method="GET|POST" action=URL">…</form>

The <form> tag's attributes are described in Table 12.1.

Table 12.1. The Attributes for the <form> Tag
AttributeDefinition
method="GET|POST"This attribute determines which request method will be used to transmit the gathered data. The default method is GET.
action="URL"This attribute ...

Get Pure Java Server Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.