Are you tracking sessions? If so, you can store your data from each form in your session storage (Cookies, database, flat-file, etc).

Let's say you're using cookies to toss the browser a session ID. Then, you're storing all session data in a file. (That's the way our web store handles shopping carts here at work.)

You can then put data in the cart like this:

open DATAFILE ">>$datadir/$sessid"; foreach $thing (keys %formdata) { print DATAFILE "$thing: $formdata{$thing}\n";

Then, you can suck that file in at the beginning of your CGI script and have the data in memory. A quick hack would be to have a hidden input tag on each form set to true. So, if someone needs to go back to form 1, they can click on the form1 link and you do this in your script:

if ($formToShow eq 'form1') { if ($sessionData{form1} eq 'True') { #Populate form fields here } else { #display unpopulated form here }

I hope that made sense.

In reply to Re: Storing sequence of cgi states by khudgins
in thread Storing sequence of cgi states by relax99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.