SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Feb 2001
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I have a page that contains a GET and a POST form. What are the differences between these two.

    <FORM ACTION="index.php3" TYPE=POST>
    <FORM ACTION="index.php3" TYPE=GET>

    Also, I have noticed there's a hidden variable, called SUBMIT, when a POST form gets submitted. Am I right?

    What will be the results when no 'TYPE' is defined? Like this one, <FORM ACTION="index.php3">

    Thanks for answering my questions...

  2. #2
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A couple of things. Technically speaking it should be method not type when differentiating between GET and POST (just so your form actually works when submitting information! )

    You are correct with regards to the hidden variable SUBMIT.

    It is highly recommended that you put the 'METHOD="post/get' in. Otherwise the form won't know what to do with it and the form gets 'reset' (and all information is lost!)

    The difference between POST and GET :

    POST : sends the inputted information to the web server as a 'transaction message body'.

    GET : sends the inputted information to the web server appended to the URL (like sitepoint.com/cgi-bin/formmail?name=bc&stuff=iloveyoursite&time=1230GMT etc.)

    The GET method is deprecated in HTML 4.0, but don't worry about that

    Hope that clears it up a bit.
    My 2 Cents (or is that 2.2 Cents including GST?)

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2001
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, if a form doesn't contain either POST or GET, will the server see it as a POST or GET?

    Also, can I emulate a URL generated by a POST form?
    If so, will this URL suffice?
    http://www.domain.com/index.php3?x=1&SUBMIT

    I have appended the SUBMIT to the URL above.

    Thanks.

  4. #4
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't include a POST or GET, the server will not be able to send the info and you lose all information you inputted in 5 minutes earlier. I just did a bit of reading and I can confirm you must have a POST or GET method specified in the <FORM> tag; otherwise nothing will happen at all (apart from losing the info).

    With regards to appending the 'SUBMIT', you can try it but I'm rather doubtful it will work.
    My 2 Cents (or is that 2.2 Cents including GST?)

  5. #5
    cd /pub; more beer diacono's Avatar
    Join Date
    Dec 2000
    Location
    Horsham, West Sussex, UK
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aditionally...
    if you use GET then you can bookmark the page without any problems.
    but with POST you woulnd be able to bookmark the rusult from a sear for example.

    at least i think i'm right.
    DIEGO MOORE

  6. #6
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's correct.
    My 2 Cents (or is that 2.2 Cents including GST?)

  7. #7
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nowadays, it seems the GET method is used more for URL redirection. If page content is retrieved dynamically from a database, a single page can be used to display multiple records, i.e. mysite.com/index.cfm?pageID=newmembers

    Whereas, the post method is used for form submission.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com


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
  •