Without seeing code and understanding your business needs, it's tough to say what would be best for you, but basically you need to maintain state either client side or server side. Each has advantages and disadvantage.

To maintain state on the client side, simply put the selected items into hidden fields:

<form ...> <input type="hidden" name="product_id" value="product_22" /> <input type="hidden" name="product_id" value="product_11" /> <input type="hidden" name="product_id" value="product_7" /> <input type="hidden" name="product_id" value="product_314" />

Then in your code, you just read off your products (example assumes that you're using CGI.pm:

my @products = $cgi->param('product_id');

This is very easy to implement, but it does mean that the user might not be able to visit another site and come back as these are maintained across a series of form submissions.

A cleaner method is to give the user a cookie with an anonymous session id and use this to look up the user's session data in a database or session file. This takes more work, but it means that the user can leave and come back later and still have the products they selected. It's also probably lower bandwidth.

Cheers,
Ovid

New address of my CGI Course.


In reply to Re: Selecting Items Across multiple screen. by Ovid
in thread Selecting Items Across multiple screen. by Anonymous Monk

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.