Page 1 of 1

Variables lost while going back

Posted: Thu Jul 22, 2010 11:48 am
by K-Z
Hi....I am developing a website and I am stuck in a weird problem. I am passing php variables from 1 php page (say x) to another php page (say y) with the help of $_POST[]. Page y makes use of the passed variable without which all of its contents are not displayed. Now, if I move on to any other page from page y and then I go back to page y, then the error Confirm Form Resubmission comes. What I am able to understand is that the problem is because of the absence of the variable that was passed from page x to page y. That is, $_POST[] is not able to get any variable or value.

Now, if I am correct, can you please tell how to cope up the loss of variables whenever a user tends to go back. One way which I have released is usage of cookies but I dont find it very suitable or preferred way. And if I am wrong, what can be reason of the error??

Please help me...

Re: Variables lost while going back

Posted: Thu Jul 22, 2010 12:04 pm
by JakeJ
You need to use sessions. There are many tutorials available. It's pretty simple but there are a few things you have to watch out for.

You can turn your post variables in to session variables so they are then available from any page in the same session.

Re: Variables lost while going back

Posted: Thu Jul 22, 2010 12:27 pm
by K-Z
JakeJ wrote:You need to use sessions. There are many tutorials available. It's pretty simple but there are a few things you have to watch out for.

You can turn your post variables in to session variables so they are then available from any page in the same session.
Thnks jake....Thts a good sol...