473,769 Members | 8,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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?
Jul 17 '05 #1
7 2601
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

http://www.tonymarston.net
"NotGiven" <no****@nonegiv en.net> wrote in message
news:13******** ****@bignews1.b ellsouth.net...
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?

Jul 17 '05 #2
.oO(NotGiven)
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?


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
Jul 17 '05 #3
In message <cf************ *******@news.de mon.co.uk>, Tony Marston
<to**@NOSPAM.de mon.co.uk> writes
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.


Agreed.

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

--
Rob...
Jul 17 '05 #4
On Mon, 16 Aug 2004 13:25:35 -0400, "NotGiven" <no****@nonegiv en.net> wrote:
Some have said to used GET for all quesries except those that
manipulate/change a database.
Yes. Use GET for idempotent operations.

So sayeth the standard:
http://www.w3.org/TR/html4/interact/...#submit-format
Some say use POST to quasi-hide parameters.


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 / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #5
"Tony Marston" <to**@NOSPAM.de mon.co.uk> wrote in message
news:cf******** ***********@new s.demon.co.uk.. .
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.


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.
Jul 17 '05 #6

"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:7p******** *************** *********@4ax.c om...
On Mon, 16 Aug 2004 13:25:35 -0400, "NotGiven" <no****@nonegiv en.net> wrote:
Some have said to used GET for all quesries except those that
manipulate/change a database.


Yes. Use GET for idempotent operations.


Idem what?! Is it when you fail to get a 'quality response' during those
special moments?
Jul 17 '05 #7
On Mon, 16 Aug 2004 23:21:11 -0400, "Chung Leong" <ch***********@ hotmail.com>
wrote:
"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:7p******* *************** **********@4ax. com...
On Mon, 16 Aug 2004 13:25:35 -0400, "NotGiven" <no****@nonegiv en.net>

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


Yes. Use GET for idempotent operations.


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


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

But actually...
http://foldoc.doc.ic.ac.uk/foldoc/fo...&action=Search

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2060
by: ganesan | last post by:
Hi Guys, Could any one knows the best coding standards styles(with variable declarations for c#) . and if any links or site with the best coding standards for .NET send me those links regards Ganesan
4
3081
by: Mikkel christensen | last post by:
Hi there I wonder if any of you could point me in a direction where I can find some usefull information about coding standarts. I have some generel experiense in programming but I lack many things specific to C++. One thing that causes me many troubles is how to properly nest "#include 'filename'" statements in combination with the "#pragma once" directive and
144
6949
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this initiative. Typically I find that coding standards are written by some guy in the company who has a way of coding that he likes and then tries to force everybody else to write code the way he likes it, not for any rational reason, but simply for the...
26
1739
by: stmilam | last post by:
Here are two different ways of accomplishing the same end: to_len ? memmove(ptr, l_to, to_len), ptr += to_len : NULL; or if ( to_len ) { memmove( ptr, l_to, to_len ); ptr += to_len; }
4
1629
by: Sue | last post by:
ASP.NET web application, data grid with several fields (Labels), table below the datagrid with several textboxes and dropdown lookup tables. When a user clicks on the "Select" button in datagrid, server side code grabs values from the selected datagrid's cells and sets the textboxes/dropdownlists below to the corresponding datagrid values. Works fine except for being dirt slow, Since all the data needed is already at the client, is there...
13
2061
by: benben | last post by:
Is there an effort to unify the c++ coding standard? Especially identifier naming. Not a big issue but it would be annoying to have to incorporate different coding styles simultaneously when using more than one library. The standard library seems to have everything lower-cased while a lot of other libraries do their own way. Ben
12
6347
by: kalinga1234 | last post by:
hy guys i am having a problem with my sudoku program which i coded using c++.; currently in my program if a duplicate number exist in either row/column/block i would make the particualr square 0. but thats not i want to do. I want to recurse back until until it find a correct number. i will post the function which i need the help; ---coding----------------------------------------------------------
4
6698
by: AzizMandar | last post by:
C++ Event Coding Questions I have done some simple programs in C++ and read a lot of good C++ books (Including The C++ Programing Language, and C++ Primer) I am trying to understand and implement an Event based program and Message system. I have a very basic event engine that I'm feeling works a bit backwards. I'm looking for documents, source code, and books that may help me better understand how to implement this type of code. I am...
3
1970
by: bb nicole | last post by:
I have did the company login and job post which means that company can post the job after they login in my webpage.. I had set company_ID(tablename:company) is foreign key of table job. But when i post the job into database, the company_ID show 0(which means when company register, the company_ID should be 2, for example, but in table job, it show 0). What should i do or what php code should i add to get the correct company_ID in table job. And...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.