views:

14

answers:

1

I have a sequence of forms that follows the following algorithm:

Form #1

  1. Prompt for input of value A.
  2. Send X* request with value A.

Form #2

  1. Display value A and prompt for input of value B.
  2. Send POST request with value A and B.

*Should X in step 2 be GET or POST? I was just going to make it POST, but hesitated and wondered if I should use GET since form #1 is just passing a value(s) to form #2 and not POSTing it to a database.

Thanks!

+2  A: 

Make a POST, since its objective is to provoke a side-effect server-side (in particular, to change the state of the multi-page form).

RFC 2616 says in section 9.1.1:

In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.

Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them.

Artefacto