How to define the HTTP method for sending data to the action URL in HTML5? Last Updated : 12 Mar, 2021 Comments Improve Suggest changes 2 Likes Like Report In this article, we will learn how to define an HTTP method to send data to the action URL. The method attribute is used to indicate how form data can be sent to the given server in the action URL. The form-data may be sent using the GET or POST method depending on the requirement. The differences between the GET and POST method are defined below: 1. GET Method The form-data is sent in name/value pairs in the URL.The URL is limited in length to about 3000 characters.Sensitive information like passwords should not be sent using the GET method as it would be visible in the URL of the request. 2. POST Method The form-data is appended within the HTTP request body.There are no restrictions on the size of the data due to this.Sensitive data could be sent using this method as it is not visible in the URL of the request. Syntax: <form method="get|post"> The below examples demonstrate the sending of data using the available methods: Example 1: Using the GET method. HTML <html> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <form action="form.php" method="get" target="_blank"> <label for="name">Name:</label> <input type="text" id="name" name="name"> <br><br> <label for="age">Age:</label> <input type="number" id="age" name="age"> <br><br> <input type="submit" value="Submit"> </form> </body> </html> Output: Example 2: Using the POST method. HTML <html> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <form action="form.php" method="post" target="_blank"> <label for="name">Name:</label> <input type="text" id="name" name="name"> <br><br> <label for="age">Age:</label> <input type="number" id="age" name="age"> <br><br> <input type="submit" value="Submit"> </form> </body> </html> Output: Create Quiz Comment P priyavermaa1198 Follow 2 Improve P priyavermaa1198 Follow 2 Improve Article Tags : Web Technologies HTML HTML5 HTML-Questions Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like