HTML Basics

HTML Forms

Forms collect information from users, such as logins, searches, and sign-ups. This page covers the form element and the most common input controls.


The Form Element

The <form> element wraps input controls. Its action attribute says where to send the data, and method says how (GET or POST).

A basic form
<form action="/submit" method="post">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name" required>

  <label for="email">Email:</label>
  <input type="email" id="email" name="email">

  <button type="submit">Send</button>
</form>

Common Input Types

TypeUse
textSingle line of plain text
emailEmail address with built-in validation
passwordHidden text for passwords
numberNumeric input with optional min and max
checkboxOne or more on/off options
radioChoose one option from a group
dateA date picker

Other Controls

Textarea and select
<textarea name="message" rows="4"></textarea>

<select name="city">
  <option value="pune">Pune</option>
  <option value="mumbai">Mumbai</option>
</select>
💡

Always pair each input with a <label> and match the label's for attribute to the input's id. This helps screen readers and lets users click the label to focus the field.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships