HTML form

A part of a web page that collects input from the user and submits it to the server.

An HTML <form> gathers user input — text boxes, checkboxes, buttons — and sends it to a server when submitted. Each field has a name, which becomes the key your server code reads. A form that changes data uses method="post".

In Flask, submitted values arrive in request.form, which works like a dictionary keyed by each field's name. Always validate that input before trusting it.

Example
<form method="post" action="/add">
  <input name="note">
  <button type="submit">Add</button>
</form>

Where this shows up in real Python

Forms collect user input on the web — logins, search boxes, comment fields — and send it to a route that validates and stores it.

Commonly used HTML form tools

  • method='post' — send data in the request body, not the URL
  • name='email' — the key your server reads the value by
  • request.form['email'] — read a submitted value in Flask
  • .strip() and validate — never trust input as-is

Official documentation: MDN Web Docs: Web Forms

Related lessons

Related terms