Hello
Is it possible to have global variables in php, variable that will keep their value in all pages that i am using in my project?
I mean, i ask the person that is visiting my site for it's name, and keep the name in some a variable, and use tht var everywhere?
Global variables, or something
Moderator: General Moderators
-
global variable will be
or
You should think of using sessions for keeping such things as username.
djot
-
global variable will be
Code: Select all
global $var;
$var='value';Code: Select all
$GLOBALS['name']='value';djot
-
sessions is what you are looking for.
next page
Code: Select all
session_start();
$_SESSION['name']=$_REQUEST['name'];Code: Select all
session_start();
$name = $_SESSION['name'];
echo "your name is $name";