Forms for HTMLs
HTML forms collect user input and send it to a server. A form element wraps controls such as input, select, textarea and button, each tied to a label. Input types like email, number and date give mobile keyboards and built-in validation, and attributes such as required and pattern check values before submission.
Stage: Forms and Interaction · Part of the HTML roadmap · Last reviewed 19 November 2026
What to learn in Forms
- Connect each control to a label using the for and id attributes
- Pick the right input type for email, number, date and password
- Apply required, min, max and pattern for built-in validation
- Group related fields with fieldset and legend
- Explain how method and action decide where form data goes
Forms interview questions
What is the difference between GET and POST in a form?
GET appends the data to the URL as a query string, suits searches and can be bookmarked, but is visible in the address bar. POST sends data in the request body, suits actions that change data or carry sensitive input, and is not stored in the URL.
Is HTML validation enough to secure a form?
No. Built-in validation improves usability but a user can bypass it by editing the page or sending requests directly. The server must validate and sanitise every value again before using it.
Where Forms fits in the HTML roadmap
Forms belongs to the Forms and Interaction stage (beginner level), which takes about 8 hours. Collect input.