Ask for an email address.
What to build
A form with one labelled input and a button.
Requirements
- A
formwithaction="/subscribe"andmethod="post". - A
labelreadingEmail, joined to aninputwithid="email". - The input has
name="email"andtype="email". - A
buttonreadingSubscribe.
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>