A newsletter form

Ask for an email address.

What to build

A form with one labelled input and a button.

Requirements

  • A form with action="/subscribe" and method="post".
  • A label reading Email, joined to an input with id="email".
  • The input has name="email" and type="email".
  • A button reading Subscribe.

Constraints

One input only.

Example

The form in the lesson has the same shape.

Why it works

The name makes the value part of the request, and the label tells every visitor what the box is for.

Hints

Hint 1

The label's for must equal the input's id.

Hint 2

Remember the name attribute, or the value is not sent.

Solution

Show one correct solution (try it yourself first)
<form action="/subscribe" method="post">
  <label for="email">Email</label>
  <input id="email" name="email" type="email">
  <button>Subscribe</button>
</form>

Lesson: Forms: asking the user for information →