What is formmethod Attribute in HTML Form ?
What is formmethod Attribute?
The formmethod attribute in HTML is used to define a HTTP technique that specify how to send form-data to the backend server. This attribute is apply on <button> , <input type= “submit”> and <input type=”image”>. It overrides the feature of method attribute of the <form> element.
How to send data?
The data can be sent to the server by using the URL variables by using the GET method and as an HTTP post by using the POST method.
What is GET and POST Method?
- GET Method: In the 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 but not for sensitive information. It supports Bookmarking the result. It can’t be used to send binary data.
- POST Method: In the post 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 bookmarking of the result.
Submit form using POST Method:
Submit form using GET Method: