Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: CGI Cookie

by ajdelore (Pilgrim)
on Sep 05, 2003 at 17:24 UTC ( [id://289293]=note: print w/replies, xml ) Need Help??


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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://289293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-23 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found