Day 5: Forms & Input

Goal

Learn how to collect data from users using forms and input elements.

Topics

Form Example

Basic form structure with a label, input, and submit button:

<form>
  <label for="name">Name:</label>
  <input type="text" id="name">
  <button type="submit">Submit</button>
</form>

Input Types

Practice

Build a contact form that collects:

Example Solution

<h2>Contact Form</h2>
<form action="#" method="post">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name"><br><br>

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

  <label for="message">Message:</label><br>
  <textarea id="message" name="message" rows="4" cols="30"></textarea><br><br>

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

Extra Tips