CODE
$name = $_SESSION['name'];
this will work if your $x variable is same as $_SESSION['x'] so $x = $_SESSION[x];
in other words, only works if the two x values r the same.
so say we had
CODE
$name = $_SESSION['name'];
$email = $_SESSION['email'];
$message = $_SESSION['message'];
$email = $_SESSION['email'];
$message = $_SESSION['message'];
what we can do to help ourselved typing those out all the time is type
CODE
$session = $_SESSION;
foreach($session as $key => $value){
$$key = $_SESSION[$key];
}
foreach($session as $key => $value){
$$key = $_SESSION[$key];
}
if there is a session variable you dont want to include in the loop such as a user logged in variable
u can do sumthing simple like
CODE
$session = $_SESSION;
foreach($session as $key => $value){
if($key == 'userloggedin'){
continue;
}
$$key = $_SESSION[$key];
}
foreach($session as $key => $value){
if($key == 'userloggedin'){
continue;
}
$$key = $_SESSION[$key];
}
userlogged in can be changed for anything you want, any variable or string
the $key is the session name and $value is what content is stored within the session name
they can be changed to anything u like
so $key cud b $cheese and $value cud b $ontoast
lol
$$key will generate the variable
so all that does, it runs through the session
pulling out the name and placing name
$here = $_SESSION[$here];
there fore generating all our session variables
er yer...luvlee
yeryer its simple i know, but hey, sum1 might find it helpful