Page 1 of 1

Help with restoring data using PHP sessions

Posted: Thu Sep 03, 2009 4:25 pm
by dreagose
I have another problem, again, I am VERY much a newbe at PHP.

After the customer selects the item they want to purchase, the data is handed off to an outside cartserver service via a form.

Code: Select all

<form action='http://www.cartserver.com/sc/cart.cgi' onSubmit='javascript&#058;pageTracker._linkByPost(this)' method=POST>
that customer has the option to "continue shopping" and if he/she clicks it they are directed back to the page they were just at ie: the PHP generated page. At this time all they are getting is a blank page because the prior posted data that was passed to it no longer exists. I have been playing (trying to learn) with $_session[] but am currently not able to restore that data needed to rebuild the page. The data is a number and 2 letters from 3 different variables.

Can someone walk me through the process of restoring that data.
Oh, and I'm not allowed to use cookies.

Thanks a bunch in advance.

Re: Help with restoring data using PHP sessions

Posted: Thu Sep 03, 2009 5:06 pm
by cpetercarter
Do you really need to use session variables for this? An alternative would be a form with hidden fields containing the data you wish to pass back. The submit button could be the "Return me to the previous page" button which you already have. And because you would be submitting POST data, you can probably use the existing script to process the data and compute the web page.

Re: Help with restoring data using PHP sessions

Posted: Wed Sep 16, 2009 4:31 pm
by dreagose
The problem is that I have no control over the page that I'm submitting the data to.

The data is submitting to an outside shopping cart service that I have VERY limited choices on options. I'm trying to keep customers from using the "Continue Shopping" option that they give with a request on the PHP page but I would like to just solve the problem and not even worry about if they select it or not.

Re: Help with restoring data using PHP sessions

Posted: Fri Sep 18, 2009 4:28 am
by cpetercarter
You say that you can't use cookies. Sessions are implemented by placing a cookie with the session id in the user's browser. Are you allowed to do that?

Re: Help with restoring data using PHP sessions

Posted: Fri Sep 18, 2009 7:34 am
by dreagose
Unfortunately, no, it's against the site policy to use cookies. (some managers idea) but I've a workaround at the moment with a javascript redirect back to the first page for the product if no other solutions can be found.

Re: Help with restoring data using PHP sessions

Posted: Fri Sep 18, 2009 9:33 am
by jackpf
You can pass the session id in the url.

Re: Help with restoring data using PHP sessions

Posted: Fri Sep 18, 2009 10:23 am
by dreagose
Yes, I could but as I said in a previous post:
The data is submitting to an outside shopping cart service that I have VERY limited choices on options. I'm trying to keep customers from using the "Continue Shopping" option that they give with a request on the PHP page but I would like to just solve the problem and not even worry about if they select it or not.
I pass the session ID but it will just dump the info and it will not pass it back.