HTML Introduction | HTML Forms | HTML Form
Form
On web pages, you can receive input from users by using the form element. The form element is also used when sending data entered by users to a server.
The form element is used with the following syntax.
Syntax
<form action="processing page address" method="get|post"></form>
action attribute
The action attribute specifies the URL address on the server that will process the entered data. The server program that processes the submitted data is called a form handler.
method attribute
The method attribute specifies how the entered data is sent to the server. Therefore, data entered by the user through the form element is delivered to the location specified in the action attribute by the method specified in the method attribute. The delivery methods that can be specified with the method attribute are divided into GET and POST.
GET method
The GET method sends data by adding it to the address. The data appears directly in the address bar, and the amount of data that can be sent is limited. Therefore, it is mainly used when sending small and low-importance information, such as search engine queries.
POST method
The POST method sends data as a separate attachment. The data is not exposed externally, and there is no limit on the size of data that can be sent. Therefore, it is better than GET in terms of security and usability.
HTML5 attributes
The attributes added to the <form> tag in HTML5 are as follows.
- autocomplete
- novalidate