Results 1 to 2 of 2

Thread: forms

  1. #1
    Join Date
    Apr 2006
    Posts
    429
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool forms

    What's the difference between $_POST and $_GET?

    can the two be use interchangeably? tnx
    Please don't mind me. I am just posting a lot of nonsense.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Simply put, GET variables are those passed by a form with method="get" or no method, while POST variables are those passed by a form with method="post".

    On a lower level, GET and POST are two different ways of sending data in HTTP. GET requests pass the data via the resource string. This can be seen in URLs such as
    Code:
    http://www.dynamicdrive.com/forums/showthread.php?p=44204
    and translates to the HTTP query (in HTTP 1.1):
    Code:
    GET /forums/showthread.php?p=44204 HTTP/1.1
    Host: www.dynamicdrive.com
    The same data sent by POST, however, would not be indicated in the URL. POST data is embedded in the request, and is therefore more flexible (GET can only send ASCII characters, and escaping all the non-ASCII characters could result in a 3x data size increase). Sending the same data by POST would translate into the following (skeleton) HTTP query:
    Code:
    POST /forums/showthread.php HTTP/1.1
    Host: www.dynamicdrive.com
    Content-Type: x-www-form-urlencoded
    Content-Length: 7
    
    p=44204
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •