PHP Session Variables [SOLVED]
Posted: Mon Mar 07, 2011 1:44 pm
Hello all -
I am working on a login scripts that uses php session variables to transfer the information across as users submit information.
When user enters their user name / pw, a .php file checks the login information vs. a mysql database and checks.
If all good, it sets the variables:
When it redirects to the next page, the variables are there, and joy I can see them:
On this page, a user will fill out new customer data. When they submit the form data on this page, it adds all the information to the mysql database on a backend page that will auto forward to a success page.
Unfortunately at this point, the variables are gone. When I try to print them on the background form submission page (after I've removed the auto forward, for testing) I get nothing. The session ID is still the same, but its as if the variables are gone.
I use session_start() on all pages, so that is all the same.
Any ideas?
Thanks
I am working on a login scripts that uses php session variables to transfer the information across as users submit information.
When user enters their user name / pw, a .php file checks the login information vs. a mysql database and checks.
If all good, it sets the variables:
Code: Select all
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
//session_register("User");
session_start();
$_SESSION["User"]=$User;
$_SESSION["User_PW"]=$User_PW;
$_SESSION["Name"]=$Name;
header("location:".$Redirect);
}Code: Select all
// At top of the page to determine if session is still good:
//Confirm session is correct
session_start();
if(!session_is_registered(User)){
header("location: /Distributors.html");
}
//Print the company name, saved as User. This works and outputs just fine.
$Company = $_SESSION['User'];
echo $Company;
Unfortunately at this point, the variables are gone. When I try to print them on the background form submission page (after I've removed the auto forward, for testing) I get nothing. The session ID is still the same, but its as if the variables are gone.
I use session_start() on all pages, so that is all the same.
Any ideas?
Thanks