Home | | Internet Programming | HTTP GET and POST requests

Chapter: Web or internet Programming : Server Side Programming

HTTP GET and POST requests

In HTML, one can specify two different submission methods for a form. The method is specified inside a FORM element, using the METHOD attribute.

HTTP GET and POST requests

 

       In HTML, one can specify two different submission methods for a form. The method is specified inside a FORM element, using the METHOD attribute.

 

       The difference between METHOD="GET" (the default) and METHOD="POST" is primarily defined in terms of form data encoding. The official recommendations say that "GET" should be used if and only if the form processing is idempotent, which typically means a pure query form. Generally it is advisable to do so.

 

       Problems related to long URLs and non-ASCII character repertoires which can make it necessary to use "POST" even for idempotent processing.


GET

   The Get is one the simplest Http method. Its main job is to ask the server for the resource.

 

       If the resource is available then it will given back to the user on your browser. That resource may be a HTML page, a sound file, a picture file (JPEG) etc.

 

       We can say that get method is for getting something from the server. It doesn't mean that you can't send parameters to the server. But the total amount of characters in a GET is really limited.

 

       In get method the data we send get appended to the URL so whatever you will send will be seen by other user so can say that it is not even secure.

 

POST

 

       The Post method is more powerful request. By using Post we can request as well as send some data to the server.

 

       We use post method when we have to send a big chunk of data to the server, like when we have to send a long enquiry form then we can send it by using the post method.

 

Example

<html>

 

<head><title>Using Post Method in Form.</title></head> <body>

<form method="post">

 

Enter your name: <input type="text‖ size="20" name="txtName" />

<input type="submit" name="B1" value="Submit" />

<input type="reset" name="B2" value="Reset" />

</form>

</body>

</html>

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Web or internet Programming : Server Side Programming : HTTP GET and POST requests |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.