typestar

Where a form sends its data in HTML

Two methods, and the difference shows up in the address bar.

<form action="/search" method="get">
  <label for="q">Search</label>
  <input type="search" id="q" name="q">
  <button>Search</button>
</form>

<form action="/orders" method="post"
      enctype="multipart/form-data">
  <label for="receipt">Receipt</label>
  <input type="file" id="receipt" name="receipt">
  <button>Upload</button>
</form>

How it works

  1. GET puts the fields in the query string: shareable, bookmarkable.
  2. POST puts them in the body: use it whenever the request changes something.
  3. enctype only matters for POST, and file uploads need the multipart one.

The run, in numbers

Lines
12
Characters to type
322
Tokens
91
Three-star pace
65 tpm

At the three-star pace of 65 tokens a minute, this run takes about 84 seconds.

Type this snippet

Step 2 of 3 in A form, step 2 of 25 in Forms & inputs.

← Previous Next →