Solved

Get and Post

Posted on 1998-08-18
3
209 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

828 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