session.cache and session.cookie question
Posted: Mon Aug 21, 2006 11:32 am
Alright I think I may finally be getting the hang of sessions.
Just a couple quick questions.
Heres how it all works:
form.php POSTS everything to Validation.php for you to see if you missed anything or need to make changes.
Click Back on browser or "make changes button" and all info is still in the form just as you typed it. Good.
If everything is right click "Create Account" and you are sent to a third "terns/conditions" page.
Accept terms everything is posted to a DB yada, yada, yada.
session_destroy() is the very last peice of PHP code on this page.
Right now im using a foreach loop to set every $_SESSION variable equal to the $_POST variables. Dont know why but this is the only way i could get my form to send any info and be able to retreive it later.
This all works just fine. But if you close the form window and re-open it all your form data is still there. And it will never leave. I have to clear my browser cache to make it go away.
So i changed in my php.ini the session.cookie-lifetime to 180. So now after 3 minutes the session finally ends and all data is cleared.
The problem is i dont want all the sessions on my set ending after 3 minutes.
Am i using session_destroy() wrong?
If my first page is a form that posts everything to a validation page do i need to use session_write_close()?
Ive seen a lot of people have trouble with redirects loosing session data and i wasnt sure what exactly qualified as a redirect.
Or do i need to set the session.cache-limiter or session.cookie-lifetime in the PHP script for my forms?
and if so how do you go about doing this?
Just a couple quick questions.
Heres how it all works:
form.php POSTS everything to Validation.php for you to see if you missed anything or need to make changes.
Click Back on browser or "make changes button" and all info is still in the form just as you typed it. Good.
If everything is right click "Create Account" and you are sent to a third "terns/conditions" page.
Accept terms everything is posted to a DB yada, yada, yada.
session_destroy() is the very last peice of PHP code on this page.
Right now im using a foreach loop to set every $_SESSION variable equal to the $_POST variables. Dont know why but this is the only way i could get my form to send any info and be able to retreive it later.
This all works just fine. But if you close the form window and re-open it all your form data is still there. And it will never leave. I have to clear my browser cache to make it go away.
So i changed in my php.ini the session.cookie-lifetime to 180. So now after 3 minutes the session finally ends and all data is cleared.
The problem is i dont want all the sessions on my set ending after 3 minutes.
Am i using session_destroy() wrong?
If my first page is a form that posts everything to a validation page do i need to use session_write_close()?
Ive seen a lot of people have trouble with redirects loosing session data and i wasnt sure what exactly qualified as a redirect.
Or do i need to set the session.cache-limiter or session.cookie-lifetime in the PHP script for my forms?
and if so how do you go about doing this?