hye guys, i had a problem where i need to pass a variable through .php page. i tried to use SESSION but it seems like after went to a page after another page, the file seems missing. how can i pass the same variable to few .php pages over and over again??
For every page you wish to access SESSION, you must use session_start(). The session will survive multiple http request, even with a page that does not have the use of sessions.
yes i did use that method but after passing the variable to a page then i use windows.history.back () it seems that the previous need to be refresh and it does not look nice after all…any idea?
Don’t use history back? Why are using that anyway?
history.back will just reload the page from the browser cache - it doesn’t download it again from the server and so doesn’t have access to changes session values.
use var_dump for troubleshooting.
the problem is when history.back reload the page from browswer cache, i got an error saying that “Document Expired. This document is no longer available.The requested document is not available in Firefox’s cache.As a security precaution, Firefox does not automatically re-request sensitive documents.Click Try Again to re-request the document from the website.” so i need to click “try again” everytime after that, then only the page will be reloaded.
The root of your problem is that your using history.back. User header(), or some other approach.
problem solved. i used windows.location instead of windows.back. ^^
Header() is the best practice here. Be in control of your app, don’t emulate user interaction like that.