HTTP POST is one of the nine standard methods of the Hypertext Transfer Protocol. The POST method is used to post data to the server, upload files and images, and submit HTML forms. The HTTP POST method differs from HTTP GET and HEAD requests in that POST requests can change the server's state.
What is HTML Form?
A form is a section of an HTML document that contains controls such as text and password input fields, radio buttons, checkboxes, and a Submit button, enclosed in an HTML <form> tag. HTML forms collect user input and send it to a server for processing. Examples of HTML forms are login and image upload forms.
Submitting HTML forms using the application/x-www-form-urlencoded media type. The application/x-www-form-urlencoded media type is mainly used for submitting short HTML forms as key-value pairs, for example, when authorizing a user using login/password forms.
HTML Login Form Request Example
POST /login HTTP/1.1
Submitting HTML forms using the multipart/form-data media type. The multipart/form-data media type is used by browsers when uploading binary data to the server (for example, when uploading multiple images). In this case, the form data is formatted as a sequence of parts separated by MIME boundaries.
Send the form data to the server using the XMLHttpRequest or fetch methods.
Submitting HTML Forms using the HTTP GET Method
Example of Sending an HTML Form using HTTP GET Method
GET /login?login=my_login&password=my_passowrd HTTP/1.1