How Forms Work

A form is how a page asks a question and sends the answer somewhere. You will see exactly what a form sends, the difference between GET and POST, and build text boxes with labels and buttons that do what you expect.

Updated

Forms and Their Data

  1. How a Form Sends Data (Apprentice): A form turns each answer into a name=value pair and sends the pairs to the address in its action, inside the address itself with GET or inside the request with POST.

Inputs, Labels and Buttons

  1. Text Inputs and Labels (Apprentice): A text input is a one-line box with a name for the data it sends, and a label tied to it by for and id tells everyone, screen readers included, what the box is for.
  2. Buttons (Apprentice): A button's type decides what it does in a form, submit, reset or nothing at all, and a button with no type sends the form, which surprises people.

Exercise: A Song Request Form

  1. Exercise: A Song Request Form (Apprentice): Build the request form for a local radio station, with four labeled text boxes and a submit button, then send it by GET and by POST and record exactly what it sent, while the tests check every box and label.