[thelist] PHP and POST

Scott Schrantz scotts at rci-nv.com
Thu Sep 13 16:19:20 CDT 2001

> -----Original Message-----
> From: Beau Hartshorne [mailto:beau at members.evolt.org]
> I am creating an ecommerce application, and wanted to send a variable
> that would invoke a function to increment a particular item in the
> shopping cart. If I use a querystring, I'm know that some 
> user will get
> upset once they hit reload, and inadvertantly add another item to the
> cart.

	If you did this with two separate pages, you could ensure that they
would only increment the cart by one. Your text link would link to an
intermediate page, and you could safely pass your data in the querystring.
The intermediate page would contain only code, no onscreen output. It would
increment the quantity and then do a server-side redirect to the second
page, where the cart would actually be viewed. Then, if the user reloaded
the cart viewing page, the quantity would stay the same since the increment
function isn't even on that page. The user would never see the intermediate
page; they could only get back to it (and the increment function) by
clicking the original link again.
	Unfortunately I don't know PHP, so I can't give you a code example.

More information about the thelist mailing list