[thelist] asp experts? 2 things...

aardvark roselli at earthlink.net
Wed Oct 4 10:56:23 CDT 2000


liz is right... you are resending your data to the page, and the 
script pulls it out and adds another item...

i get around this a different way, however...

- i request the cart item from the form submit...
- i check for a session variable named 'foo', if it isn't there...
- i add item to the cart...
- i set a session variable named 'foo'...
- if, however, foo was already there, i just display the page...

how do you clear 'foo' to add more products?

simple, do that on your product selection page... kill 'foo' there, 
effectively forcing all cart submissions to come only from that 
page...

does that make any sense?

On 4 Oct 00, at 16:35, Liz Lawson wrote:
 
> Refresh resends the last request to the server, which in this case
> triggers a script which causes item x to be added to the cart. The
> server runs the same script with the same input so you get the same
> result: item x is added.
> 
> My pages are all generated on the fly, so I get around the refresh
> problem by including a hidden value "now" in my forms whose value is
> the time the page was generated, and saving this as a session variable
> when the form data is processed. If a submitted "now" matches a saved
> "now" I know the page has been refreshed and drop through to the
> basket display without acting on the input.
> 
> If your form pages are static html this won't be possible. Maybe you
> could save the form input in your session and check for an exact match
> before you act on it. (i'm sure there'll be a lot of better
> suggestions, but you can see what I'm getting at).




More information about the thelist mailing list