GET and POST methods

Discussion in 'PHP' started by Naughty Son, Jul 10, 2008.

  1. #1
    Does anyone know exactly when to use the GET and when to use the POST methods, why and why not?


    Thanks in advance.
     
    Naughty Son, Jul 10, 2008 IP
  2. uzairjawed

    uzairjawed Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    USing POST method is secure because it will not show any variable in the URL
     
    uzairjawed, Jul 10, 2008 IP
  3. Naughty Son

    Naughty Son Peon

    Messages:
    613
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's right. POST method doesn't show any URL and is more suitable for secure transactions.

    I recently came across this 'idempotent' stuff. They say it is advisable to use the GET method for idempotent transactions and the POST method, if otherwise. And the benefit?? Am I right if I say that the only benefit is that the browser-makers can design more consistent warnings? Or are there any other 'real' benefits?
     
    Naughty Son, Jul 10, 2008 IP
  4. mlkshake

    mlkshake Peon

    Messages:
    73
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I use POST for almost everything. But remember if you don't do a header redirect after the POST it will ask them to resend the data when they refresh. And there is a limit on the amount of characters allowed in the GET method.
     
    mlkshake, Jul 10, 2008 IP
  5. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I use GET for most of simple data query, for example like this:

    article.php?id=1 or
    article.php?category=whatever

    POST is most likely to be used whenever you want to submit something like login/registration form.
     
    revvi, Jul 11, 2008 IP
  6. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #6
    I use POST for almost everything. But remember if you don't do a header redirect after the POST it will ask them to resend the data when they refresh. And there is a limit on the amount of characters allowed in the GET method.

    Which is like 100,000 in most browsers. Regardless of what the W3schools site saying its about 100.
     
    Danltn, Jul 11, 2008 IP