HTML Basic
Differences in the usage of GET and POST in HTML forms
There are two data transfer methods for HTML Form, namely GET and PSOT. When the web has filled in the form data and pressed the button to send the form, the data must be sent to the server (Web Server ), the following are two ways of writing HTML Code.
1. GET delivery method
<form action="The program to receive data" method="get">
Two, POST transmission method
<form action="The program to receive data" method="post">
Either GET or POST can pass data, but the two need to be selected in terms of application. First, let’s take a look at their differences and know how to choose.
| GET | POST | |
| URL difference | The URL will contain the parameters and information of the HTML Form. | The URL will not change when the data is transferred. |
| Data transfer | Since the data is carried through the URL, there is a length limit. | Since there is no parameter through the URL, it is not limited to the length of the URL. |
| safety | The form parameters and filling content can be seen in the URL. | Through the HTTP Request method, the parameters and filling content will not be displayed in the URL. |
Strictly speaking, the general form can be directly transmitted by GET, and the information that needs to be kept confidential must be processed by POST, such as the account password for member login. The following picture is an example of the URL presentation result of transferring data through GET. It can be seen from the URL that the parameter in the form is name, and the value passed is My name is Jef.

Therefore, if you do not want the account and password to be displayed in the URL bar when a netizen logs in, it is best to use POST.
Post a Comment
0 Comments