HTML <button> with formmethod Attribute

You are Here:

HTML <button> with formmethod Attribute

The formmethod attribute specifies the HTTP method that the browser uses to submit the form.

Note: The formmethod attribute is only used for buttons with type="submit".

Get

Appends the form-data to the URL in name/value pairs format.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/get.php"> Name: <input type="text" name="myname"> <button type="submit" formmethod="get">Submit</button> </form> </body> </html>

Attribute Value

ValueExplanation
getAppends the form-data to the URL in name/value pairs format.
postSends the form-data as an HTTP post transaction.
The post method will not append the form-data to the url.

Post

Sends the form-data as an HTTP post transaction.

The post method will not append the form-data to the url.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/post.php"> Name: <input type="text" name="myname"> <button type="submit" formmethod="post">Submit</button> </form> </body> </html>

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author