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

Email:

Password:

Attribute values

All possible values of method attribute

method="post"

video value hints the browser that only video files should be accepted.

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

In POST method sensitive information can be sent.

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.

<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 accept attribute

<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: