OK i have page1.php with form fields filled in with data from mysql.
<input type="text" name="location" size="30" value="<? echo($row[18]);?>"> etc.etc..........
I use the following to validate user:
<? session_start();
if ( session_is_registered ("myuser") )
{
when the form goes to the other page ( page2.php ) the data is displayed on page2 fine but.................
If they decide to go back and change something on page1.php when sent to page2 again the changes have not been applied because of the session saves the values from page1 on the first submit......
How can i change the session so it will keep changing values if they hit the back button ? Or will a refresh work on page2 ? if so whats the code ??
Thanks
Small problem with sessions
Moderator: General Moderators
I think you are experiencing your browser's ability to cache what was on the page, and not a session "storing" your form element values (unless you explicity saved the values to session variables yourself?).
You need to decide whether you want to use the GET or POST method to move your values from page1 to page2. As a rule of thumb... use GET when navigating around your site, and use POST when the values are going to to be written to your database.
When you use POST, you will not really be able to hit the 'back' button.. at least not without getting a warning from your browser that, "this page was created using [POST] values which may no longer be available, do you want to reload the page anyway?"...
Hope this gets you pointed in the right direction.
You need to decide whether you want to use the GET or POST method to move your values from page1 to page2. As a rule of thumb... use GET when navigating around your site, and use POST when the values are going to to be written to your database.
When you use POST, you will not really be able to hit the 'back' button.. at least not without getting a warning from your browser that, "this page was created using [POST] values which may no longer be available, do you want to reload the page anyway?"...
Hope this gets you pointed in the right direction.
-
bionicdonkey
- Forum Contributor
- Posts: 132
- Joined: Fri Jan 31, 2003 2:28 am
- Location: Sydney, Australia
- Contact: