Do you know where your variables are? | |
PerlMonks |
Re: Keeping Form Valuesby hanenkamp (Pilgrim) |
on Oct 22, 2003 at 00:29 UTC ( [id://301125]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|