🎯 Learning Objectives

By the end of this class, students will be able to:

  1. Understand what forms are and their purpose.
  2. Learn the basic <form> tag and its important attributes (action, method).
  3. Explore common form elements
  4. Learn how to group inputs with <label> for accessibility.
  5. Understand basic form layout and organization.

🧩 Part 1: What is a Form?

Concept:

A form is like a questionnaire or survey on a website. It collects information from users and sends it to the server.

Basic Syntax:

<form action="submit.php" method="post">
  <!-- Form inputs go here -->
</form>

Attributes:

Attribute Description
action URL where the form data will be sent
method HTTP method (get or post)

🧩 Part 2: Common Form Elements

1️⃣ Text Input

<label for="name">Name:</label>
<input type="text" id="name" name="name">

2️⃣ Password Input

<label for="password">Password:</label>
<input type="password" id="password" name="password">

3️⃣ Email Input