HTML forms with the form element
A form groups controls so a user can enter data and submit it to a destination.
What you will learn
- How labels and controls work together
- What
actionandmethoddo
Minimal example
<form action="/signup" method="post"> <label for="email">Email</label> <input id="email" name="email" type="email"> <button type="submit">Send</button> </form>The label identifies the input, and the form sends its named values when submitted.
Common mistakes
- Give every control a label and a
name. - Choose the method that matches how the server should receive data.
- Do not rely on client-side validation alone for sensitive data.