Re: GET and POST
- From: Chuck Anderson <websiteaddress@xxxxxxxxx>
- Date: Sat, 30 Jul 2005 14:32:36 -0600
Shelly wrote:
----- Original Message ----- From: "Andy Hassall" <andy@xxxxxxxxxxx>
Newsgroups: comp.lang.php
Sent: Friday, July 29, 2005 6:32 PM
Subject: Re: GET and POST
On Fri, 29 Jul 2005 21:43:29 GMT, "Shelly" <sheldonlg.news@xxxxxxxxxxxxxxxx>
wrote:
I have a question that is going to make me look stupid, but as I am new to html and php (2 months), I'll as it anyway.
I have been using POST as the action and to get values that were input. I
understand that GET could also be used as the action (not just to get stuff
after the "?" which I understand).
a. When should GET be used and when should POST be used?
b. What is the difference between the two?
Over to the standard which has a brief explanation:
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.1
Thank you. I read this. I was looking for a complete description.
One thisg, though. I still cannot discern when it is best that I should use method GET and when it is best that I should choose method POST. So far, I have always used POST (because that is the first that I saw in an example).
Shelly
Begin generalizations:
Post is normally the best to use. With the POST method your arguments are not visible in the URL, making it less obvious how your scripts could be compromised. I always try to use forms and the POST method to pass variables between pages (in general, this requires the site user to click on a button to cause the next action).
I only use GET when I don't have a way to use form submission (you can POST variables without using a form with curl or fsockopen, but the better alternative is to use session variables). I also use GET (if the logic/page flow will not let me use a form) if the variables are inconsequential.
I'd say you are best to stick with POST.
Here's more of the kind of discussion you seem to be after. http://www.w3.org/2001/tag/doc/whenToUseGet.html
-- ***************************** Chuck Anderson • Boulder, CO http://www.CycleTourist.com Integrity is obvious. The lack of it is common. ***************************** .
- Follow-Ups:
- Re: GET and POST
- From: John Dunlop
- Re: GET and POST
- References:
- Re: GET and POST
- From: Shelly
- Re: GET and POST
- Prev by Date: Php problems w/ Gallery
- Next by Date: Re: php.ini is output_buffering effected after Global Variables change?
- Previous by thread: Re: GET and POST
- Next by thread: Re: GET and POST
- Index(es):