Form Fundamentals
The <form> element represents an interactive section for submitting information. Its action specifies where data is sent and method determines the HTTP method used for submission. Common methods include GET and POST.
Basic Form
<form action="/search" method="get">\n <label for="query">Search</label>\n <input id="query" name="q" type="search">\n <button type="submit">Search</button>\n</form>💡 The form submits the named input to the specified action using GET.
Key Takeaways
- The name attribute determines the submitted field name.
- GET commonly represents retrieval-oriented submissions while POST is commonly used for creating or changing data.
Knowledge Check
Which attribute identifies the destination URL of a form submission?