The Form Element
<form> … </form>
Section titled “<form> … </form>”The form element wraps input fields and controls how and where the data is sent.
<form action="/submit-form" method="post" name="contactForm"> <!-- form fields go here --></form>The form tag should include, at minimum, the following attributes:
-
action
- The URL of the form processing endpoint (file)
-
method
-
How the data is sent for processing \
- get
- data is sent via URL parameters
- useful for search and other non-sensitive data
- post
- data is sent in the body of the HTTP request
- this is the most common method
- get
-
-
name
- offers a way to identify the form to the server