Connecting Tech Pros Worldwide Forums | Help | Site Map

Php Session Problem

Newbie
 
Join Date: Jan 2008
Posts: 2
#1: Jan 6 '08
Hello,

i have one application in that i use session .
problem is,
same code and session data use work successful in Firefox but not work in Internet Explore.

Thanks & Regards
Deepak

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,940
#2: Jan 6 '08

re: Php Session Problem


That's a shame.

Post the code you're using..
Newbie
 
Join Date: Jan 2008
Posts: 2
#3: Jan 6 '08

re: Php Session Problem


Quote:

Originally Posted by markusn00b

That's a shame.

Post the code you're using..

//After login on home page
<?php
session_start();
session_register('id');
$_SESSION['id']=$userid; //user id after successful login
.

.
// bla bla bla
.


?>

//when i try to move to following page

<?php

session_start();
print_r($_SESSION); //some debugging info
die();
?>

the session array dont show the userid added

------------------------------------------------------------------------------------

After browsing the pages the session data shows correct in Firefox but empty session in IE.
Member
 
Join Date: Feb 2007
Posts: 94
#4: Jan 7 '08

re: Php Session Problem


It's a bit hard to tell where it's going wrong without being able to play around with it. But try printing out the cookies that IE has sent to the page, if IE has not sent the PHPSESSID cookie back to you then you know... well you know that it's not sending the cookie back!!
[PHP]print $_COOKIE['PHPSESSID'];
//OR
print_r($_COOKIE);[/PHP]

If that does turn out to be the problem, then I would suggest installing Live HTTP Headers for FireFox. I know the problem is in IE, but being able to see the headers that are being sent is MASSIVELY useful when dealing with problems like this. You can see the HTTP header that sets the cookie, and you can see the headers that the browser sends back to PHP.

Hope that helps
Reply