HTML <form> method Attribute

The method attribute on a <form> tag specifies the method to use for form submission.

The two possible methods are GET or POST.



A method attribute on a <form> element. The form is submitted with the GET method. Enter data, submit, and notice the name/value pairs on the query string (browser command line).

User Information

<form action="/tutorial/action.html" method="get">
  <fieldset style="background: #f6f8ff; border: 2px solid #4238ca;">
    <legend>User 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>

Using method

The method attribute specifies the method of submitting form data: GET or POST.

The GET method uses URL name/value pairs to send data. This is the default method.

The POST method use an HTTP post transaction with data in the body of the request.

For more details on GET and POST methods see our HTTP methods Tutorial.


<form method="GET | POST">



Value Description
GET The default value. It sends data using URL name/value pairs which is visible. Therefore, GET should not be used when handling sensitive data (e.g. passwords, bank information).
POST Sends data using an HTTP post transaction with data in the request body, which is invisible. The POST method is more secure.

Browser support

Here is when method support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like

 Back to <form>

Last updated on Sep 30, 2023