in reply to CGI Cookie

I don't think you need a cookie. Instead of printing out a page from the CGI script, re-direct the user to a new page using an HTTP redirect.

open FH, ">>report_sum.txt" or die "Cant open report_sum.txt Reason: $+!"; my $writestr="..." print FH $writestr, "\n"; close FH; print redirect("http://mysite.com/thankyou.html");

NB: Make sure you don't print out anything else (including other HTTP headers) before the redirect.

</ajdelore>

Replies are listed 'Best First'.
Re: Re: CGI Cookie
by rupesh (Hermit) on Sep 08, 2003 at 06:51 UTC
    Hi...
    Thanks for your "redirect" script. It was something new, though I remember using it some years back. I have a question: Suppose I'm entering the details and submitting a form, the thankyou.html would get created, and would contain either the message "entry successful" or "fields invalid" and would display in the browser (lets say it shows me "fields invalid"). Suppose someone else did the same thing at the same time, and he/she entered all the fields successfully, then the thankyou.html would show "entry successful". What will happen if I refresh that page? It would also show me "entry successful" right?

    I also thought of appending the thankyou.html with a timestamp, but that would lead to lot of such files getting created....
    Any alternatives?
    Thanks for your time.

    Did you ever notice that when you blow in a dog's face, it gets mad at you but when you take him on a car ride,he sticks his head out the window and likes it?