Re: Saving param after new recall of a cgi script

[email protected] (Rene Schickbauer) Tue, 01 Dec 2009 12:50:36 +0100
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
Marek wrote:

Hi!

> How do I save the parameters from the first input? I tried everything,
> but there is nothing kept in my array. Do I have to save these
> parameters into an external file?

You could also use Storable & Base64 to encode your data structure into 
a Base64 string. Put this string into a hidden text field. When the 
second form is submitted, you can decode your original data structure 
from that hidden field.

That way, you don't have to store ANYTHING on your server until the user 
hits the final SUBMIT.

Something like this could do the trick:
<http://search.cpan.org/~cavac/Maplat-0.9/lib/Maplat/Helpers/DBSerialize.pm>

I originally wrote it to store perl data structures into a database text 
field, should work in a hidden HTML form, too. Something like this:

<input type="hidden" name="foo" value="YourEncodedString">


LG
Rene