I'm going to assume from what you have described that you're passing your parameters through QUERY_STRING or PATH_INFO, and the browser is using an HTTP GET on the CGI script.

If you're modifying anything based on the result of a request, you should not use GET, you should use an HTML form, with a POST method.

Modern web browsers will NOT resend the data if the user clicks refresh from a POST. Of course, many will refuse to send anything at all, so you'll want to follow the HTTP recommendation, and send a 201 status and a Location header to point them to the stable URI for the item. (ie, a read-only URI).

Update: as Ieronim correctly points out -- almost all browsers will send it, but they should prompt first. (I should have said 'will not resend the data without warning', but that's of little condolence, as most users won't understand the implications.) A few browsers also haven't followed the recommendation under History List, and will ask you to resend the POST if you wish to go 'back' in your browser history.

To deal with both of these issues, I'll repeat myself, and suggest the combination of 201 w/ a Location header to a stable URI for the created/modified record.


In reply to Re: CGI and Sessions by jhourcle
in thread CGI and Sessions by santhi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.