Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Keeping Form Values

by hanenkamp (Pilgrim)
on Oct 22, 2003 at 00:29 UTC ( [id://301125]=note: print w/replies, xml ) Need Help??


in reply to Keeping Form Values

Lots of ways. You've already stumbled upon the most obvious, which is to tack the values onto the end of the redirect URI. However, this is by no means the only way.

You can remember session information via cookies on the user's browser (or place a session identifier at the end of your link URLs or as <input type="hidden" .../> fields in forms). You can then have a temporary file on the local machine keyed to that session value storing the information, which may be restored. In fact, CGI contains a rather nice facility to help with this via the save method.

You could also save the data to something like a database. If you use cookies and the amount of data to be stored is relatively small, you could store the data in the cookie itself. (Won't work well for you, though, if you get many paranoid folks such as myself who mostly turn off cookies.)

Another solution I can think of would be to execute form.cgi directly within your processor script. This would replace $q->redirect("form.cgi") with a do, eval, or require to compile and execute the other form script's code. This way it could inherit the state directly, rather than be executed on its own via a second user request. Of course, this means that the form would appear at the processor URL, but it's another possibility.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2025-01-22 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (63 votes). Check out past polls.