Form basics

GET vs POST

GET and POST are the two HTTP methods an HTML form can use. GET adds the fields to the URL, while POST sends them in the body of the request.

Also called: HTTP POST, form method, method attribute

The method attribute of a <form> decides how the browser sends the fields to the form action URL.

GET

With method="GET" the fields are appended to the URL as a query string: /search?q=forms&page=2. That makes the result bookmarkable and shareable, which is right for a search box or a filter. It also means the data shows up in the address bar, browser history, server logs and referrer headers, and the length is limited by the URL.

POST

With method="POST" the fields travel in the body of the request. They do not appear in the URL, and the size limit is much higher. POST is the right choice whenever the form sends something that is private, changes something on the server or can be long: contact forms, sign-ups, orders and anything with a message or a file.

Rules of thumb

  • Reading or looking something up: GET.
  • Sending a message, creating a record or uploading a file: POST.
  • Never put personal data or secrets in a GET form.
  • If the form is submitted by a script with fetch, the method is whatever you pass, but the same reasoning applies.

Encoding goes with the method

A POST body can be encoded as application/x-www-form-urlencoded (the default) or as multipart/form-data, which is required for file uploads.

In StaticForm

Forms are submitted to the endpoint with POST, in either encoding. Outgoing webhook actions use POST by default and can also be set to GET, PUT, PATCH or DELETE, for example to call an API that expects a different method.

Learn more