How to define the HTTP method for sending data to the action URL in HTML5? Last Updated : 12 Mar, 2021 Summarize Comments Improve Suggest changes Share Like Article 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: Comment More infoAdvertise with us Next Article How to define the HTTP method for sending data to the action URL in HTML5? P priyavermaa1198 Follow Improve Article Tags : Web Technologies HTML HTML5 HTML-Questions Similar Reads How to specify the form-data should be encoded when submitting it to the server in HTML5? In this article, we will specify the form-data should encoding when submitting it to the server by using the enctype attribute in the <form> element in the HTML document. This property specifies the data that will be present in the form that should be encoded when submitting to the server. Thi 1 min read Which HTTP method is used to send the form-data ? In this article, we will learn the HTTP method to send the form data. Before diving into this topic, we need to know what exactly is the HTTP method and how many HTTP methods available. What is HTTP? The HTTP stands for HyperText Transfer Protocol. It is used to communicate between clients and serv 3 min read How to give the value associated with the http-equiv or name attribute in HTML5 ? The http-equiv and name attribute are specified in the meta tag in an HTML program. The meta tag is included at the head of the HTML document. It is used to define the metadata (data that describes data) about the HTML document. There are a lot of different elements under meta, but we will be discus 2 min read How to specify the response page after submitting the form using HTML5 ? In this article, we will specify the response page after submitting the form by using the action attribute in the <form> element in the document. This property is used to specify the URL page or destination of the form data that to be sent to the server after submission of the form. It can be 1 min read How to use URL of the image as a submit button in HTML ? The HTML <input> type attribute is used to specify the type of <input> element to display. The default type of <input> type attribute is text. In this article, we set the image as button value. It creates the image as the submit button. Syntax: <input type="image"> Attribute 1 min read Like