philisophical coding question - when to use GET/POST

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NotGiven

    philisophical coding question - when to use GET/POST

    Some have said to used GET for all quesries except those that
    manipulate/change a database.

    Some say use POST to quasi-hide parameters.

    Your thoughts?


  • Tony Marston

    #2
    Re: philisophical coding question - when to use GET/POST

    Generally speaking you should only use POST when submitting a for which will
    update any type of data. An update form will therefore have two methods -
    GET, which will retrieve the existing data and display it ready for the
    user's changes, and POST which will accept the user's changes and process
    them.

    The GET method is typically used where you want to give the user the ability
    to bookmark a page as all the relevant data is held in the URL and does not
    rely on an existing session on the server. It is therefore not possible to
    bookmark a request which uses the POST method.

    HTH.

    --
    Tony Marston

    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



    "NotGiven" <noname@nonegiv en.net> wrote in message
    news:136Uc.16$6 y1.6@bignews1.b ellsouth.net...[color=blue]
    > Some have said to used GET for all quesries except those that
    > manipulate/change a database.
    >
    > Some say use POST to quasi-hide parameters.
    >
    > Your thoughts?
    >
    >[/color]


    Comment

    • Michael Fesser

      #3
      Re: philisophical coding question - when to use GET/POST

      .oO(NotGiven)
      [color=blue]
      >Some have said to used GET for all quesries except those that
      >manipulate/change a database.
      >
      >Some say use POST to quasi-hide parameters.
      >
      >Your thoughts?[/color]

      I use:

      post: for all actions that manipulate data stored on the server
      get: for all actions that query information from the server, a
      site-wide search for example

      Micha

      Comment

      • Rob Allen

        #4
        Re: philisophical coding question - when to use GET/POST

        In message <cfqreh$bkc$1$8 302bc10@news.de mon.co.uk>, Tony Marston
        <tony@NOSPAM.de mon.co.uk> writes[color=blue]
        >The GET method is typically used where you want to give the user the
        >ability to bookmark a page as all the relevant data is held in the URL
        >and does not rely on an existing session on the server. It is therefore
        >not possible to bookmark a request which uses the POST method.[/color]

        Agreed.

        Use GET for search results our your products so that your users can
        email links to each other and buy more!

        --
        Rob...

        Comment

        • Andy Hassall

          #5
          Re: philisophical coding question - when to use GET/POST

          On Mon, 16 Aug 2004 13:25:35 -0400, "NotGiven" <noname@nonegiv en.net> wrote:
          [color=blue]
          >Some have said to used GET for all quesries except those that
          >manipulate/change a database.[/color]

          Yes. Use GET for idempotent operations.

          So sayeth the standard:

          [color=blue]
          >Some say use POST to quasi-hide parameters.[/color]

          I don't really see what this buys you. They're not hidden, and POST differs
          from GET in other ways.

          Although if you have the mother of all search forms, you might hit the browser
          limits on the length of GET URIs (somewhere from 512-1024 bytes IIRC), whereas
          POST has much larger limits. Would have to be one hefty form though; I've got
          one at work for a bug database search that densely fills a decent sized window,
          and it still doesn't get near the limits.

          --
          Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
          <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

          Comment

          • Chung Leong

            #6
            Re: philisophical coding question - when to use GET/POST

            "Tony Marston" <tony@NOSPAM.de mon.co.uk> wrote in message
            news:cfqreh$bkc $1$8302bc10@new s.demon.co.uk.. .[color=blue]
            > Generally speaking you should only use POST when submitting a for which[/color]
            will[color=blue]
            > update any type of data. An update form will therefore have two methods -
            > GET, which will retrieve the existing data and display it ready for the
            > user's changes, and POST which will accept the user's changes and process
            > them.
            >
            > The GET method is typically used where you want to give the user the[/color]
            ability[color=blue]
            > to bookmark a page as all the relevant data is held in the URL and does[/color]
            not[color=blue]
            > rely on an existing session on the server. It is therefore not possible to
            > bookmark a request which uses the POST method.
            >[/color]

            Agree. Typically I don't output anything on a POST request. After processing
            the submitted data I redirect to a GET. Makes it easier to test. When the
            data reappears on the form, I know it was correctly saved. Also get rid of
            the annoying repost message.

            The only exception I say would be a login form, which should always be
            posted.


            Comment

            • Chung Leong

              #7
              Re: philisophical coding question - when to use GET/POST


              "Andy Hassall" <andy@andyh.co. uk> wrote in message
              news:7p22i09d5m 3lb7ep4udt6t452 aspdrisu5@4ax.c om...[color=blue]
              > On Mon, 16 Aug 2004 13:25:35 -0400, "NotGiven" <noname@nonegiv en.net>[/color]
              wrote:[color=blue]
              >[color=green]
              > >Some have said to used GET for all quesries except those that
              > >manipulate/change a database.[/color]
              >
              > Yes. Use GET for idempotent operations.[/color]

              Idem what?! Is it when you fail to get a 'quality response' during those
              special moments?


              Comment

              • Andy Hassall

                #8
                Re: philisophical coding question - when to use GET/POST

                On Mon, 16 Aug 2004 23:21:11 -0400, "Chung Leong" <chernyshevsky@ hotmail.com>
                wrote:
                [color=blue]
                >"Andy Hassall" <andy@andyh.co. uk> wrote in message
                >news:7p22i09d5 m3lb7ep4udt6t45 2aspdrisu5@4ax. com...[color=green]
                >> On Mon, 16 Aug 2004 13:25:35 -0400, "NotGiven" <noname@nonegiv en.net>[/color]
                >wrote:[color=green]
                >>[color=darkred]
                >> >Some have said to used GET for all quesries except those that
                >> >manipulate/change a database.[/color]
                >>
                >> Yes. Use GET for idempotent operations.[/color]
                >
                >Idem what?! Is it when you fail to get a 'quality response' during those
                >special moments?[/color]

                I've got a load of junk mail I ought to forward to these web servers suffering
                idempotent responses then ;p

                But actually...


                --
                Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
                <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

                Comment

                Working...