Sesssion help
| From: | Hasan / Impex Holidays Maldives | Date: | Fri, 13 Dec 2002 10:00:51 +0000 |
| Subject: | Sesssion help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-128138@lists.php.net to get a copy of this message | ||
Hi,
I am just starting to use PHP sessions... very interesting.
I have two test scripts which is working fine on my PC. However when i
upload the script to my Unix server there is a problem. I am trying to pass
on the variable from file1 to file2. I have a link to file2 with the session
id on file1. When i view file2 i can see only the session id not the other
values.
I have below the two files...I hope some one can help. I can retrieve the
variable on file1 so this means that the variables are being saved in the
session store. Cannot understand why it does not appear on file2.
FILE 1
========
<?php
session_start();
$sid = session_id();
$form_agent_id = "agent";
$form_agent_pass = "pass";
$_SESSION["cookie_agtuser"] = "$form_agent_id";
$_SESSION["cookie_agtpasswd"] = "$form_agent_pass";
$cookie_agtuser = $_SESSION['cookie_agtuser'];
$cookie_agtpasswd = $_SESSION['cookie_agtpasswd'];
echo "agt = $cookie_agtuser";
?>
<HTML>
<BODY>
<a href="file2.php?PHPSESSID=<? echo $sid; ?>">File2</a>
</BODY>
</HTML>
FILE 2
=======
<?php
session_start();
$cookie_agtuser = $_SESSION['cookie_agtuser'];
$cookie_agtpasswd = $_SESSION['cookie_agtpasswd'];
global $cookie_agtuser;
echo "$PHPSESSID";
echo "agt = $cookie_agtuser";
echo "pass = $cookie_agtpasswd";
?>
Cheers,
Hasan