Connecting Tech Pros Worldwide Forums | Help | Site Map

sessions not available to different browser window.

Simon
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi Folks,

Any help here would be much appreciated.


i have a page session_write.php
///////////////////
session_start();
$_SESSION['A'] = 'AAA';
print("sA". $_SESSION['A']);
//////////////////////


and session_read.php
//////////////////
session_start();
if (isset ($_SESSION['A']))
{
print ('sessions set');
}
else{
print ('sessions not set');
}

print($_SESSION['A']);
//////////////////////

if i call session_write.php and then session_read.php in the same browser
window all is fine. but if i call session_read.php from a different browswer
window, it doesn't see the session variable A.

I'm using php 4 on linux and internet explorer 6 on windows 2000.

What could be happening here?

thanks,

simon.




Tony Marston
Guest
 
Posts: n/a
#2: Jul 17 '05

re: sessions not available to different browser window.


When you open up another browser window you are effectively creating a new
session.

Tony Marston

"Simon" <simon@nospami-muse.nu> wrote in message
news:RDAhb.174074$JA5.4377292@news.xtra.co.nz...[color=blue]
> Hi Folks,
>
> Any help here would be much appreciated.
>
>
> i have a page session_write.php
> ///////////////////
> session_start();
> $_SESSION['A'] = 'AAA';
> print("sA". $_SESSION['A']);
> //////////////////////
>
>
> and session_read.php
> //////////////////
> session_start();
> if (isset ($_SESSION['A']))
> {
> print ('sessions set');
> }
> else{
> print ('sessions not set');
> }
>
> print($_SESSION['A']);
> //////////////////////
>
> if i call session_write.php and then session_read.php in the same browser
> window all is fine. but if i call session_read.php from a different[/color]
browswer[color=blue]
> window, it doesn't see the session variable A.
>
> I'm using php 4 on linux and internet explorer 6 on windows 2000.
>
> What could be happening here?
>
> thanks,
>
> simon.
>
>
>[/color]


Kevin Thorpe
Guest
 
Posts: n/a
#3: Jul 17 '05

re: sessions not available to different browser window.


Simon wrote:
[color=blue]
> Hi Folks,
>
> Any help here would be much appreciated.
>
>
> i have a page session_write.php
> ///////////////////
> session_start();
> $_SESSION['A'] = 'AAA';
> print("sA". $_SESSION['A']);
> //////////////////////
>
>
> and session_read.php
> //////////////////
> session_start();
> if (isset ($_SESSION['A']))
> {
> print ('sessions set');
> }
> else{
> print ('sessions not set');
> }
>
> print($_SESSION['A']);
> //////////////////////
>
> if i call session_write.php and then session_read.php in the same browser
> window all is fine. but if i call session_read.php from a different browswer
> window, it doesn't see the session variable A.
>
> I'm using php 4 on linux and internet explorer 6 on windows 2000.
>
> What could be happening here?
>
> thanks,
>
> simon.[/color]

As someone else has said each browser window is a separate session. If
you want to link the two then you can always pass the session id in the
GET or POST

Closed Thread