HTML method Attribute: The HTML method attribute used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP Methods, which are GET and POST. The method attribute can be used with the <form> element.
HTML method Attribute
This attribute can be applied on <form> element.
GET: In this GET method, after the submission of the form, the form values will be visible in the address bar of the new browser tab. It has a limited size of about 3000 characters. It is only useful for non-secure data not for sensitive information.
POST: This method after the submission of the form, the form values will not be visible in the address bar of the new browser tab as it was visible in the GET method. It appends form data inside the body of the HTTP request. It has no size limitation. This method does not support bookmark the result.
Syntax: <form method=”get|post”>
This attribute is supported by the following browsers :
- Internet Explorer
Example: for using method attribute
<!DOCTYPE html> <html> <body> <form action="/action_page.php" method="get" target="_blank"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="Submit"> </form> </body> </html>