A RetroSearch Logo

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

Search Query:

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

HTML | <button> formmethod Attribute

HTML | <button> formmethod Attribute

Last Updated : 20 Jul, 2022

The HTML button formmethod 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. This Attribute is only used with the Button type="submit".

Syntax:

<button type="submit" formmethod="get|post">

Attribute values:

Example: This Example illustrate the use of formmethod Attribute in Button Element. 

html
<!DOCTYPE html>
<html>

<head>
    <title> 
      Button Formmethod attribute
    </title>
</head>

<body style="text-align: center">
    <h1 style="color: green">
      GeeksforGeeks
    </h1>
    <h4>
      HTML Button Formmethod Attribute
    </h4>
    <form action="#" method="post" 
          enctype="multipart/form-data">
        First name:
        <input type="text" name="fname">
        <br><br>
        Last name:
        <input type="text" name="lname">
        <br><br>
        Address:
        <input type="text" name="Address">
        <br><br>
        <button type="submit" formmethod="GET">
          submit using GET 
        </button>
        <br>
        <br>
        <button type="submit" formenctype="text/plan" 
                formmethod="POST">
          submit using POST
        </button>
    </form>
</body>

</html>

Output:

  

Supported Browsers: The browsers supported by HTML <button> Formmethod 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