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