Forms and Inputs
Forms let users send data to servers — login, signup, search, checkout. The <form> element is one of HTML's most powerful tags. HTML forms made e-commerce possible.
Basic Form
<form action="/submit" method="POST"> <!-- label for= links to input id= --> <label for="name">Your Name</label> <input type="text" id="name" name="name"/> <label for="email">Email</label> <input type="email" id="email" name="email"/> <button type="submit">Send</button> </form>
Checkbox and Radio
<!-- Checkbox: multiple can be selected --> <label> <input type="checkbox" name="agree"/> I agree to terms </label> <!-- Radio: only ONE can be selected from group --> <label><input type="radio" name="plan" value="free"/> Free</label> <label><input type="radio" name="plan" value="paid"/> Paid</label>
Select Dropdown
<label for="course">Pick a course</label> <select id="course" name="course"> <option value="">Select...</option> <option value="html">HTML Basics</option> <option value="css">CSS Styling</option> </select>
Every input needs a label. Without labels, screen readers cannot tell blind users what each field is for. Labels also improve tap targets on mobile — the whole label area becomes clickable.
Use GET for search forms (data visible in URL). Use POST for login, signup, checkout (data in request body, more secure). NEVER use GET for passwords.
The first secure online purchase was in 1994 — a Sting CD sold on NetMarket using an encrypted HTML form. Today HTML forms process trillions of dollars in transactions every year.