I'm trying to use session_start to store a few variables that are required by several pages on my website. However, it seems like if I access the same page twice it resets the PHPSESSIONID initializes the variables.
If before the session_start I set the session_id to session_id("1234") it works fine.
Any ideas?
Using session_start()
Moderator: General Moderators
session_start()
JPlush76 wrote:can you paste the top part of you code in so we can look?
at the top of get_coaches_user_password.php
<?php
/* start a session */
session_id("1234");
session_start();
session_register('theuser');
session_register('thepassword');
?>
at the top of validate_user_password.php
<?php
session_id("1234");
session_start();
?>
it does not work if I remove the session_id("1234")
Thanks, Steve
-
JPlush76
- Forum Regular
- Posts: 819
- Joined: Thu Aug 01, 2002 5:42 pm
- Location: Los Angeles, CA
- Contact:
Code: Select all
<?php
session_start();
$_SESSIONї'theuser'] = 'jplush76';
$_SESSIONї'thepassword'] = 'pass';
echo $_SESSIONї'theuser'];
?>More session_start()
Hmmm...maybe I don't understand sessions...I thought it would maintain the same session_id across multiple accesses of the same page as long as it was called from the same client / browser?
What I have noticed is if I load the same page twice with session_start() I get a new session_id....if I go from one page to the next and call session_start() at the top of each page it works fine.
A setting in my php.ini ???
What I have noticed is if I load the same page twice with session_start() I get a new session_id....if I go from one page to the next and call session_start() at the top of each page it works fine.
A setting in my php.ini ???