in reply to Selecting Items Across multiple screen.
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.
|
|---|