Page 1 of 1
Problem with Session Varables
Posted: Sat Feb 28, 2004 4:53 pm
by Zelpus
<?php
session_start();
$username= $_POST['logname'];
$_SESSION['name'] = $username;
$userpswd= $_POST['logpswd'];
$_SESSION['pswd'] = $userpswd;
?>
When I goto the next page theres nothing in these varables, is there something I need to do to register these that I am not doing?
Thanks in advance
Posted: Sat Feb 28, 2004 5:27 pm
by markl999
And the second page also has session_start() in it? Eg
session_start();
var_dump($_SESSION);
Posted: Sat Feb 28, 2004 5:31 pm
by Zelpus
I am reloading everything into the same page, so session_start is in every page. I have never seen var_dump what does it do?
Thanks in advanced.
Posted: Sat Feb 28, 2004 5:38 pm
by penguinboy
This has nothing to do with theory and design.
The solution... maybe.. :)
Posted: Tue Mar 02, 2004 8:05 pm
by cyberhawk
I had the same problem, check your php.ini and locate this:
session.use_trans_sid = 0
and change the 0 to 1:
session.use_trans_sid = 1
Then reboot your puter.
And then your script will work, promise.
And 4 some code, have a look at my little test.
First page
Code: Select all
<?php
session_start();
$un = "anders";
$_SESSION['uname']=$un;
$_SESSION['ualias']='olle';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
?>
<p><a href="test4.php">Page 2</a></p>
Second page
Code: Select all
<?php
session_start();
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
echo $_SESSION['uname'];
echo $_SESSION['ualias'];
?>
Posted: Wed Mar 03, 2004 4:37 am
by twigletmac
Please don't cross-post it's totally unneccessary.
Mac