Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Saving param after new recall of a cgi script

0 views
Skip to first unread message

Marek

unread,
Nov 26, 2009, 4:35:48 PM11/26/09
to beginn...@perl.org

Hello all!


Hope that I can explain my problem clearly:

1. I have a long form, created from a "xyz.cgi" (action="" that means
is empty)
2. The user fills up the form and sends (action="send") The
parameters are send with an self reference to the same "xyz.cgi". This
script examines with several routines the user-input. If everything is
alright the script is sending back a
3. confirmation page, which is containing also a form, but only with
one button: "cancel" and everything as text, which where filled into
the first form. This page is saying, that everything is alright so
far. But if the user has some doubts, or if there has been an error,
he may push the button "cancel"
4. The cancel-page (action="cancel") should show once again the
parameters of step 3, which the user filled up in step 2 ...

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?


Hope that my English was explaining good enough my problem. The script
itself is much to long ...

Best greetings from Munich


marek

Robert Roggenbuck

unread,
Nov 27, 2009, 4:42:25 AM11/27/09
to Marek, beginn...@perl.org
You should store the values from step 2 at step 3 in hidden parameters (<input
type="hidden" ...>). The You can access them via CGI in step 4.

An alternative would be storing the whole CGI-object in a file using
Data::Dumper and recreate it using 'do $file'.

Greetings

Robert

Marek schrieb:

Greg Jetter

unread,
Nov 27, 2009, 2:43:20 PM11/27/09
to beginn...@perl.org


User Data Validation is best preformed using JavaScript on the users browser
, checking for junk should be done on the server side . You might want to
approach the problem from a different perspective


Greg
.

Marek

unread,
Nov 27, 2009, 2:49:20 PM11/27/09
to beginn...@perl.org
On 27 Nov., 10:42, rrogg...@uni-osnabrueck.de (Robert Roggenbuck)
wrote:

> You should store the values from step 2 at step 3 in hidden parameters (<input
> type="hidden" ...>). The You can access them via CGI in step 4.
>
> An alternative would be storing the whole CGI-object in a file using
> Data::Dumper and recreate it using 'do $file'.
>
> Greetings
>
> Robert
>


Thank you Robert! I will try both solutions tomorrow ...

Have a nice weekend!


marek

Rene Schickbauer

unread,
Dec 1, 2009, 6:50:36 AM12/1/09
to beginn...@perl.org
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

0 new messages