Jump to content

Recommended Posts

this is for an e-commerce site but can be applied to elsewhere as well. i'm absolutly sure there's a better way, but cannot find it.

 

i have a product page, add-to-cart button calls the same page, gets an action-flag (1 = add to cart) and i that producted to a session kept Object stream (serialzed)  :o

 

my problem has to do with the back button.  :'(

 

here's the issue, if i use GET (ie productPage.php?pageAction=1&etc..") then when i click the back button, it re-excutes that URL (and thus the product gets re-added to the order object stream.  >:(

 

if i use POST , when i click back, i get a Page Not Found 404 or Page Has Expired. (which on refresh will again re-add the product to the order).  >:(

 

 

the solution i've found is to use a "processing" page. this processing page changes the "header" , so it never gets loaded into the browser's history, but i simply cannot have that. i'm passing other stuff (like message = "your product has been successfully added" for example) which i don't want to use header (Locaton: page.php?message=) ;

 

there's got to be a better way to this kind of processing,how do the big guys do it, eBay, Amazon.  ???

 

 

any pointers and directions will be greatly appreciated, 8)

 

 

please let me know if you need more info about my code/setup.

 

 

-Dan Murad  :)

 

Link to comment
https://forums.phpfreaks.com/topic/73997-get-post-im-still-doomed/
Share on other sites

It's not too big of a decision.

Get if you want them to be able to visit it via url.

Post if you don't.

Each one has there good uses and bad uses.  There is also sessions, cookies, and push.

I suggest if it's something security related (maintaining state for long periods of time) to use standard sessions.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.