The ‘method’ attribute in form element specifies how to send form-data(the form-data is sent to the page specified in the ‘action’ attribute).
The form-data can be sent as URL variables(with method='get'
) or as HTTP Post transaction(with method='post'
).
Notes on GET:
- Appends form-data into the URL in name-value pairs;
- The length of a URL is limited(about 3000 characters);
- Never use GET to send sensitive data cause they will be visible in the URL;
- Useful for form submissions where a user want to bookmark the result;
- GET is better than non-secure data, like query string in Google.
Notes on POST:
- Appends form-data inside the body of HTTP request(both in head-line and body);
- Has no size limitation;
- Form submissions with POST cannot be bookmarked.