Solved

Get and Post

Posted on 1998-08-18
3
201 Views
Last Modified: 2010-03-05
I remember seeing somewhere a brief, if somewhat simplified explanation of which method was best in which situation. I've looked on a lot of faq sites, but can't find anywhere that contrasts the two. Could anyone fill me in?
Cheers
0
Comment
Question by:AndrewThomason
3 Comments
 

Expert Comment

by:brunovan
ID: 1204388
use post to send it as input to a script, and use get to send it to a file.

Bruno
0
 

Author Comment

by:AndrewThomason
ID: 1204389
To brief
0
 
LVL 1

Accepted Solution

by:
evilgreg earned 80 total points
ID: 1204390
Short answer:
GET is quick and efficient, but very limited.
POST is a little harder to implement, but more secure (and nice looking) and handles more data.

(This isn't really a perl question, per se, but...)

GET advantages:
- It's short and quick
- You can see all the data that is going to be submitted.
- It can be put into a link, and no FORM tags are necessary.
- It's real easy to change the input, especially when testing a new form

GET disadvantages:
- All the data is world viewable (see any search engine for an example)
- It can form really long, ugly URL's
- It severly limits the amount of data that can be sent

POST advantages:
- Data is not world viewable
- Short, sweet URLs. The same URL can do many different things.
- Send as much data as you want

POST disadvantages:
- Harder to debug your apps (although this is easy to get around)
- Harder to code for the client (HTML) and for the server (cgi)

Generally, GET should be used for short, quick inquiries (again, see the search engines). For more than a few fields or a few lines of data, use POST.

Because GET data gets shoved into an environment variable (QUERY_INFO), it has a finite limit on how much data can be sent it. It's a lot, but I find it personally "cleaner" to just use POST most of the time, in which the data becomes stdin and can hold as much as you want.

Some good times to use GET:
Search forms
Simple redirects

Some good times to use POST:
Long user input forms
Sending data between forms
Hiding previous data cleanly with the INPUT TYPE=HIDDEN tag.

A final caveat, it really does depend on the exact situation: the amount of data, how comfortable you are with each type, how important speed is, how important "nice looking" URLs are, etc...

0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question