HTML Form Attributes
This chapter describes the different attributes for the HTML <form> element.
The Action Attribute
The `action` attribute defines the action to be performed when the form is submitted. Usually, the form data is sent to a file on the server when the user clicks on the submit button.
<form action="/action_page.php">
The Method Attribute
The `method` attribute specifies the HTTP method to be used when submitting the form data. The form-data can be sent as URL variables (with `method="get"`) or as HTTP post transaction (with `method="post"`).
| Method | Description |
|---|---|
| GET | Appends form-data into the URL in name/value pairs. Length of a URL is limited (about 3000 characters). Never use GET to send sensitive data. |
| POST | Appends form-data inside the body of the HTTP request. Has no size limitations, and can be used to send large amounts of data. |
Method Post Example
Result
The Target Attribute
The `target` attribute specifies where to display the response that is received after submitting the form.
For example, `target="_blank"` will open the response in a new window or tab.