HTML Form Attributes

Attributes on the <form> element control how it is submitted.

The action attribute sets where the data goes, and method sets how it is sent, usually get or post.

Form attributes

<!DOCTYPE html>
<html>
<body>

<form action="/submit" method="post">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name">
  <button type="submit">Send</button>
</form>

</body>
</html>
Note: Use post when the form changes data or sends anything sensitive.

Exercise: HTML Form Attributes

What does the "action" attribute on a <form> specify?