HTML <input> with formmethod Attribute
You are Here:
HTML <input> 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 <input> 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">
<input type="submit" formmethod="get">
</form>
</body>
</html>
Attribute Value
Value | Explanation |
---|---|
get | Appends the form-data to the URL in name/value pairs format. |
post | Sends 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">
Name: <input type="text" name="myname">
<input type="submit" formmethod="post">
</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.