A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-method-attribute/ below:

HTML method Attribute - GeeksforGeeks

HTML method Attribute

Last Updated : 11 Jul, 2025

The HTML method Attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP Methods, which are GET and POST. The method attribute can be used with the <form> element. 

Attribute Values: 

Syntax: 

<form method="get|post">

Example: This Example illustrates the use of method attribute. 

HTML
<!DOCTYPE html>
<html>
<body style="text-align:center;">
    <h1 style="color:green;"> 
    GeeksForGeeks 
    </h1>
    <h2>HTML  method Attribute</h2>
    <form id="users"
          action="#"
          method="GET" 
          target="_blank">
        First name:
        <input type="text" 
               name="fname"
               value="Manas">
        <br> Last name:
        <input type="text"
               name="lname"
               value="Chhabra">
        <br>
        <input type="submit"
               value="Submit">
    </form>
    
<p>
      After submitting the form, 
      input values are shown in the address 
      bar of the window.
      </p>

</body>
</html>

Output: 

Supported Browsers: The browser supported by HTML Method Attribute are listed below: 



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4