Get Versus Post Method

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email

What is the difference between the GET and POST methods? GET passes the encoded input string via the environment variable QUERY_STRING, whereas POST passes it through stdin. POST is the preferable method, especially for forms with a lot of data, because there is no limit to how much information you can send. On the other hand, you are limited with the GET method by the amount of environment space you have.

If you do not specify a METHOD attribute in the <form> tag, the browser uses the GET method by default. In order to determine which method is used, the CGI program checks the environment variable REQUEST METHOD, which will either be set to GET or POST. If it is set to POST, the length of the encoded information is stored in the environment variable CONTENT LENGTH.

Where to Use Get and Post?

Use GET to transfer a small amount of data and POST to send large amounts of data. For example GET is appropraite for a search form that solicits a few keywords from the user. On the other hand, you would want to use POST for a feed back form with a free form text entry area, because the user might enter a considerable amount of text.

If a CGI program is desgined to receive data with the POST method, you cannot activate that program with a URL like the following: http://www.someplace.com/cgi bin/dbquery? keyword= linux.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.