Web development

Submit a simple search form with GET

Use a GET form when submitting a shareable query that retrieves information without changing server state. Named controls become query parameters in the destination URL.

Worked example

HTML example · save as example.html and open in a browser

<form action="/search" method="get">
  <label for="query">Search</label>
  <input id="query" name="q" type="search" required>
  <button type="submit">Find guides</button>
</form>

How it works

The browser constructs a URL such as /search?q=files. That URL can be bookmarked or shared. The form works without client-side JavaScript if the destination actually handles the request, giving a simple baseline for progressive enhancement.

Limits and mistakes

A static host does not automatically provide a search endpoint. Do not submit passwords or sensitive fields through URL parameters because URLs can enter history and logs. State-changing operations need a different request and protection design.

Check the result

Implement the /search handler or adapt the destination before publishing. Submit a query containing spaces and confirm it is encoded correctly and returned as the intended search term.

Sources

Reference documentation for the behavior used in this guide: