FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » sessions causing refreshing not to work
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: sessions causing refreshing not to work [message #178325 is a reply to message #178315] Mon, 04 June 2012 07:12 Go to previous messageGo to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 03/06/2012 5:17, Michael Joel escribió/wrote:
> I have page data being sent through a php script that uses sessions to
> pass along variables. These vars are used to load data.
>
> If a user opens a page, everything works fine.
> If they open another in a new window it works fine.
> If they tab back over to the original browser window and hit refresh it
> switches to the last page they opened in the other window.
>
> This is because sessions is keeping that last var data in memory so the
> old page when refreshed reads the new var data and opens new data
> instead of refreshing the old.
>
> How would I go about fixing this so a page doesn't lose it's var data on
> refresh?

Your description suggests that you are using a (single) global session
variable to save a setting that can take many values. It's hard to
suggest a fix without further details but I have the impression that you
should be using an array to store the server side information and a GET
parameter to store the array key. E.g.: instead of:

/example.php
$_SESSION['search'] = 'foo'
$_SESSION['page'] = 33
$_SESSION['results'] = 'blah';

.... you should do something like:

/example.php?search=foo&page=33
$_SESSION['foo'][33]['results'] = 'blah';

/example.php?search=bar&page=1
$_SESSION['bar'][1]['results'] = 'hello';



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: passing documents through pages
Next Topic: PHP Sessions and XML
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 09 14:42:37 GMT 2024

Total time taken to generate the page: 0.04756 seconds