Hello,
I have a little problem. I have been writing some programs using
PHP. All of them use "sessions". Many use "session variables". One
day the programs are working fine. The next day puff. Nothing
works. I've done some testing and I believe I have narrowed the
problem down. It seems that the "session variables" are being lost
after a <FORM> is submitted. Below are the scripts from two simple
programs which I believe illustrate my problem. Any help would be
greatly appreciated
..Bill
Below are two scripts two distinct files. The first one simply
sets the session variable and branches to the second file. Please
understand that all the <HTML> and <BODY> statements are present but
have been eliminated from here to save space.
------- first script or file begins here ---------
<?
session_start();
$_SESSION['user']="Confused";
echo("<CENTER>Session_id: ".session_id());
echo("<BR>User: ".$_SESSION['user']);
?>
<BR><A HREF='http://newwavephotog.com/Programs/test_SID02.php?<?php
echo(SID);?>'>Next Page</A><BR></CENTER>
------- end of first script or file -------
Below is the second script which is called above. It is
called "test_SID02.php". The first set of "echos" show that the SID
has been passed from the previous script and that the session
variable is set. Eveything looks good until I press the "submit" key
for the form. After I click on the "submit" key, all the "echo"
statements indicate that SID has been changed and that the session
variable is blank. Nada. Zero. El Disapeero. Why?
------ second script or file begins here -----------
<?
session_start();
/*
first set of echos
*/
echo("<CENTER>Session_id: ".session_id());
echo("<BR>User: ".$_SESSION['user']);
$self=$_SERVER['PHP_SELF'];
?>
<BR>
<FORM action="<?php echo($self);?>" method="POST">
<input type='TEXT' name='testing'>
<input type='submit' name='submit' value='TEST'>
</FORM><BR>
<?php
/*
second set of echos
*/
echo("Session_id: ".session_id()."<BR>");
echo("<BR>New Session: ".$_SESSION['user']);
?>
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/