HTML method attribute

method attribute specifies HTTP method to submit the form.


<form action="files/method.php" method="post">
 <p>Email:<input type="email" name="email"></p>
 <p>Password:<input type="password" name="password"></p>
 <p><input type="submit" name="login" value="sign in"></p>
Try </>

method attribute values

There are two HTTP methods to send the data.


In POST method sensitive information can be sent.

<form method="post" action="address"> </form>

The top most example uses the POST method.


In GET method, the data is appended to URL obtained by the action attribute. The entered information can be seen in the URL. This method should not be used for the sensitive information such as password, credit card number etc.


<form method="get" action="" target="_blank">
 <input type="search" name="q">
 <input type="submit" name="source">

Related Tags

The tags that support method attribute are given below.

<form> method

The form collects the information from the user. input controls use different types for different type of data in the form.

Was this article helpful?




Get the newsletter