HTML input formmethod Attribute

Last Updated : 19 May, 2026

The formmethod attribute is used to specify the HTTP method used to send form data. It overrides the method attribute of the <form> element for a specific submit button.

  • Defines the method used for form submission, such as GET or POST.
  • Works with <input type="submit"> and <input type="image">.
  • Overrides the form’s default method attribute for that submission.

Syntax:

<input formmethod="get | post">

Attribute Values:

  • GET: Sends form data through the URL, making it visible in the address bar. It is suitable for non-sensitive data and supports limited data size.
  • POST: Sends form data inside the HTTP request body, so it is not visible in the URL. It supports larger data and is more secure than GET.
html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML input formmethod Attribute
    </title>
</head>

<body style="text-align:center;">

    <h1 style="color:green;">
      GeeksforGeeks
  </h1>

    <h3>HTML &lt;input&gt; 
      formmethod Attribute</h3>

    <form action="#" 
          id="users"
          action="#" 
          method="GET"
          target="_blank">

        First name:
        <input type="text"
               name="fname" 
               placeholder="Enter first name">

        <br>
        <br> Last name:
        <input type="text"
               name="lname"
               placeholder="Enter last name">
        <br>
        <br>

        <input type="submit" 
               value="Submit" 
               formmethod="post">

    </form>
</body>

</html>

Output:

Supported Browsers

The browsers supported by HTML input formmethod Attribute are listed below:

  • Google Chrome 9.0
  • Edge 12.0
  • Internet Explorer 10.0
  • Firefox 4.0
  • Safari 5.0
  • Opera 12.1
Comment