An HTML form submission is exposed to a server as an HTTP GET or POST request.
When a form is submitted, the browser collects the form data and serializes it:
Serialization is the process whereby a data structure is translated into a format suitable for transfer over a network.
For GET requests
Data:
- is URL-encoded
- and added in the URL's query string as query param(eter)s
Notes:
- the max length of an URL has a de facto limit of 2000 characters
- the exact structure of the query string is not standardized
- the HTTP request body is empty
For POST requests
Data:
- is serialized into the structure specified by the
enctypeattribute - and added in the HTTP request body
application/x-www-form-urlencodedmultipart/form-datatext/plain
Query params
Any HTTP method type may include query params.
When a form is submitted using the POST method to an URL containing query params:
- the query params are sent to the server
- they are separated from the request body
- they should be treated as read-only