HTML <form> with method Attribute

You are Here:

HTML <form> with method Attribute

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

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" method="get"> Name: <input type="text" name="myname"> <button type="submit">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. Not appended to 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" method="post"> Name: <input type="text" name="myname"> <button type="submit">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