
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML Form method Attribute
The HTML form method attribute defines how to send form-data that means to be sent as URL variable or to be sent as an HTTP post transaction.
Syntax
Following is the syntax −
<form method=”get | post”></form>
Here get sends the form data as URL variable and post sends the form data as an HTTP post transaction.
Let us see an example of HTML Form method Attribute−
Example
<!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat; text-align: center; } input { width: 315px; display: block; margin: 1rem auto; border: 2px solid #fff; padding: 8px; background: transparent; border-radius: 20px; outline: none; } ::placeholder { color: #000; } .btn { background: #db133a; border: none; height: 2rem; border-radius: 20px; width: 330px; display: block; color: #fff; outline: none; cursor: pointer; margin: 1rem auto; } </style> <body> <h1>HTML Form method Attribute Demo</h1> <form action="/action_page.php" method="get"> <input type="text" name="firstname" placeholder="Enter First Name"> <input type="text" name="lastname" placeholder="Enter Last Name"> <input type="submit" value="SUBMIT" class="btn"> </form> </body> </html>
Output
Enter the form details and then submit the form using “SUBMIT” button to observe how method attribute works.
- Related Articles
- HTML form Attribute
- HTML Form action Attribute
- HTML DOM Form method Property
- HTML DOM Form reset() method
- HTML DOM Form submit() method
- HTML maxlength Attribute
- HTML wrap Attribute
- HTML checked Attribute
- HTML datetime Attribute
- HTML value Attribute
- HTML coords Attribute
- HTML hreflang Attribute
- HTML cite Attribute
- HTML cite Attribute
- HTML autocomplete Attribute

Advertisements