PDA

View Full Version : problem with sessions variable transfers


songboy
12-11-2009, 11:06 PM
I've got this at the top of my login page:
<?php
session_start();
include("connection.php");
switch(@$_POST['choose'])
{
case "backagain":
etc etc.
Then further on, after the login has been verified I have this:
$_SESSION['auth']="yes";
$logname=$_POST['user_name'];
$_SESSION['logname'] = $logname;
When I run the login form it all works fine and just to check, I have this at the bottom of the script:
include("add_the_songsa.php");
echo $logname." ".(SID);
The new form appears and at the base of the form the SID code appears.
So far so good.
BUT...When I fill-in the new form and submit it I get a warning saying that $logname is not defined. Now I've got session_start() at the top of the new script which processes the new form so I'm assuming that the session variable should transfer. I've put an echo SID at the top of the form too but nothing shows.
Basically, I think the session ID is getting lost or is being dropped between scripts. I noticed that when, on the second form, I didn't fill in the fields and pressed submit, the ID hash disappeared. This convinces me that the ID is being cancelled before it can be accessed by the next script.
I have googled the problem for days and still can't get to the answer.
If you've had this problem or you have an idea what might be going wrong please give me some advice.
Thanks-
Songboy.:(

edbr
12-12-2009, 12:47 AM
<?php
session_start();
Print_r (http://php.about.com/od/phpfunctions/g/print_r_php.htm) ($_SESSION);
?>
should echo all sesion values transfered. try that to check