dlite922 Posted October 19, 2007 Share Posted October 19, 2007 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) 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, please let me know if you need more info about my code/setup. -Dan Murad Quote Link to comment https://forums.phpfreaks.com/topic/73997-get-post-im-still-doomed/ Share on other sites More sharing options...
darkfreaks Posted October 19, 2007 Share Posted October 19, 2007 <?php if(!submit) { header("Location: http:/mysitecom/error.php");} else { header("Location: http://mysite.com/success.php");}?> Quote Link to comment https://forums.phpfreaks.com/topic/73997-get-post-im-still-doomed/#findComment-373519 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/73997-get-post-im-still-doomed/#findComment-373633 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.