Jump to content

sessions not passing data to next page


fpyontek

Recommended Posts

Session data is sent to my session.save_path (C:\Program Files\tmp), but does not pass to the next page.  (I'm using WinXP PHP5 Apache2.2)  I tried a simple script (see below).  The same script works as expected on my Linux box (PHP4.* Apache2.*.) The php.ini files are identical (except for session.save_path ).  The only way I could get the session data to pass ( in WinXP) is to pass the SID in the header URL, e.g.

 

header("Location:page2.php?".strip_tags(SID));

 

Which is obviously undesirable on other than localhost.  Thanks.

 

(page1.php)

<?php

session_start();

$_SESSION['fname'] = 'DERF';

$_SESSION['eMailAddr'] = '[email protected]';

 

header("Location:page2.php");

 

/* uncomment the header below, and comment the header above

    and the session data will pass to page2.php (in WinXP)*/

//header("Location:page2.php?".strip_tags(SID));

?>

 

(page2.php)

<?php

session_start();

echo $_SESSION['fname'];

echo $_SESSION['eMailAddr'];

?>

 

Link to comment
https://forums.phpfreaks.com/topic/37974-sessions-not-passing-data-to-next-page/
Share on other sites

Is PHP being able to save to that DIR? Do you see files in c:\Program Files\tmp from PHP

 

Thanks for the reply.

 

Yes, I can write to "C:\Program Files\TMP\somefile.txt" and read from the same file using php.

An interesting note, I had to change the name of the folder from "tmp" to "TMP" because "\t" is a non-printing character and no such file "...\ mp\somefile.txt" was found on my first try.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.