commenting

The comment systems of the linkomatic, 15 ways, and shoplifters, unite all work like this:

  1. user submits comment form using HTTP POST
  2. comment form is validated on the client side
  3. comment data is validated and saved on the server side
  4. server redirects to destination page using an HTTP 301 redirect, thereby avoiding double-POST problems

In step 4, the redirect page is also given a “status” code as a GET argument. The destination page can then use this code to display some sort of confirmation message, like “Your comment was posted.” It would be better to pass the status code in a session variable that is destroyed as soon as the page is loaded. This removes the status code from the URL and prevents the confirmation message from being displayed if the page is refreshed.

[ article last updated 2006-02-16 16:03:37 by cobra libre ]