A method="post"
attribute value specifies that the form data will be sent to the server by storing it in an HTTP request body.
This method is used to transfer data securely using HTTP headers.
A method="post"
on a <form> tag.
Enter data, submit, and notice there are no name/value pairs on the url (browser command line).
<form action="/tutorial/action.html" method="post">
<fieldset style="background: #f6f8ff; border: 2px solid #4238ca;">
<legend>Customer Information</legend>
<input type="text" name="firstname" placeholder="First name"><br /><br />
<input type="text" name="lastname" placeholder="Last name"><br /><br />
<button type="submit">Submit</button>
</fieldset>
</form>
The method attribute specifies the method to use for form submission.
The method="post"
value sends form data using HTTP headers.
This method is used when data is added or modified on the server, i.e. save to database, upload files, etc.
<form method="post">
Only one element uses the method attribute with the post value.
Elements | Description | |
---|---|---|
<form> | Specifies an HTML form -- see example above |
Used to add or modify data on the server
Form data is not stored in browser history
There is no limitation on length of data sent
Optionally send binary data (e.g. images, files)
It is secure and can send sensitive information, i.e. password, credit card, etc.
Post requests are not cached by the browser
A post request cannot be bookmarked
Re-submitting a form resends the same data which can cause duplicate entries
Here is when method support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |