Tutorials

HTML Tutorial

All Tutorials Learning Tools Login

HTML Tutorial · Chapter 8 of 9

HTML Forms

Collect user input.

form groups inputs. Use label, input, select, and button.

required helps validate empty fields in the browser.

Form sample Try it Yourself »
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Forms</title>
</head>
<body>
    <h1>Registration</h1>
    <form>
        <label>Full Name
            <input type="text" name="fullName" required>
        </label>
        <label>Course
            <select name="course">
                <option>BSCS</option>
                <option>BSIT</option>
            </select>
        </label>
        <button type="submit">Register</button>
    </form>
</body>
</html>

Classroom Tips

  • Every input should have a clear label.
  • Later lessons connect forms to JavaScript.