Back to course

Lesson 21: Introducing Forms and the `<form>` Tag

The HTML Masterclass: From Zero to Web Developer

21. Introducing Forms and the <form> Tag

Forms are how we collect user input (login details, search queries, feedback).

21.1 The <form> Container

All input elements must be placed inside the <form> tag. This tag handles how and where the data is sent.

21.2 Key Form Attributes

  1. action: Specifies the URL where the form data will be submitted (usually a server-side script).
  2. method: Specifies the HTTP method used to send the data. The two most common are GET and POST.
MethodUse CaseDescription
GETRetrieving data (e.g., searching).Appends form data to the URL. Visible and limited in length.
POSTSubmitting data (e.g., logins, file uploads).Sends data in the body of the request. Secure and supports large amounts of data.

html