start_session / session variable in PHP not read by Firefox
I have som PHP pages with session variables. It works (still) fine in Chrome and Microsoft Edge and until a few days ago it also worked fine in Firefox. All of a sudden Firefox doesn't get the value of the variables anymore.
Anyone any suggestions?
تمام جوابات (7)
Hi fpbosmans, your server processes your PHP script and sends browsers standard HTML, CSS, and JavaScript. You can see what the server is sending by calling up View Source on your page in Firefox. Either:
- Ctrl+u
- right-click a blank area of the page > View Page Source
- menu button > Web Developer > Page Source
- (menu bar) Tools > Web Developer > Page Source
Does the source show the values that you expect?
Firefox can be very tenacious with cached data, so if the page is showing obsolete date, try reloading the page bypassing the cache. Either:
- Shift+click the Reload button
- Ctrl+F5
- Ctrl+Shift+r
No this doesn't work. Firefox doesn't read the session variables (refreshing the page doesn't help either). I'm guessing it has something to do with security settings.
Try this: http://dietrich.soundtoll.nl/public/index.php?periode=_vroeg
periode=_vroeg is saved as a session variable and should be available. But when you (I?) chose one of the options it has gone away and showing the page without 'periode' set. As I said: it wordkes before and it works in other browsers
Hi fpbosmans, your link gives me this red text on the page:
"Database 1: 668.565 registrations; years 1497 - 1633."
Clicking Years after 1633 gives me:
" Database 2: 1.484.051 passages; years 1634 - 1857."
Clicking Years before 1634 switches it back.
I'm not sure what you mean by this part:
But when you (I?) chose one of the options it has gone away and showing the page without 'periode' set. As I said: it wordkes before and it works in other browsers
When I click Statistics, the red text is carried over to stats.php. I don't know whether that is what you meant by options.
Thanks for your patience! That is exactly what should happen, the red text should stay the same! The new page reads the session variable to get the correct period. Only on my computer it all of a sudden doesn't work anymore, the session variable comes up empty. (And as I said not with other browsers.) Frank
Actually, Firefox doesn't have access to session variables, those are stored in memory on the web server. Firefox sends the PHP session cookie to the server with each request, and that allows the PHP script to use the session variables. Can you think of any reason that Firefox would not be setting or returning cookies to your server?
You can check the HTTP request headers in the Network Monitor to see what is send to the server if you click a link or button.
- "3-bar" menu button or Tools -> Web Developer
- https://developer.mozilla.org/en-US/Tools/Network_Monitor
In the end the solution was very simple: I have deleted all saved cookies and now it's working again!
Thanks for your help, your answers set me on the right track!