Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variables Question 2

Status
Not open for further replies.

4x4uk

Technical User
Apr 30, 2002
381
GB
I am currently working on an access validation script which sets up a session when the user successfully logs on ie

//I will ultimately be validating usernames and password
//from a text file just keeping it simple at the moment to
//get everything working.

If($_POST[uname]=="ABC"){

session_start();
$_SESSION[members] = $_POST[uname];

Header("location:protected.php");
} else{
Header("location:login.php");
}

The question is as follows when I do a
print($_SESSION[members])
from the prtected page I get the following result

ABC1

Where does the 1 come from and how do I prevent it from displaying and can I attach additional data to the $_SESSION[members] variable ie the users full name as well as username or should i create a second session variable
 
Don't forget to quote the names inside the brackets. So it should be $_POST["uname"] and $_SESSION["members"].

For additional data use additionial session variables. Or group everything inside an array (it's perfectly legal to have session arrays). It's not a lie if YOU believe it ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top