HTML method attribute

method attribute specifies HTTP method to submit the form.

Example

<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>
</form>
Try </>

method attribute values

There are two HTTP methods to send the data.

method="post"

In POST method sensitive information can be sent.

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

The top most example uses the POST method.

method="get"

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.

Example

<form method="get" action="http://www.google.com/search" target="_blank">
 <input type="search" name="q">
 <input type="submit" name="source">
</form>
Try</>

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?

 

Email:

Message:

Get the newsletter