Skip to main content
Albero Academy

Form Basics

Collect user input with the form element.

Forms9 min

Forms collect input from users — logins, searches, checkouts. The <form> element wraps the controls and defines where and how the data is sent.

A basic form

form with action and method
<form action="/submit" method="post">
<label for="name">Name</label>
<input type="text" id="name" name="name" />
<label for="email">Email</label>
<input type="email" id="email" name="email" required />
<button type="submit">Send</button>
</form>

action & method

Key takeaways

  1. 01The <form> element wraps input controls and a submit button.
  2. 02action is the URL that receives the data; method is GET or POST.
  3. 03GET puts data in the URL (searches); POST sends it in the body (changes/sensitive data).
  4. 04Every input needs a name attribute — it's the key the server receives.

Finished this chapter?

Mark it complete to track your progress through HTML.