Page 1 of 1

session: how to call value

Posted: Wed Sep 19, 2007 10:03 pm
by chxxangie
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


[u]page A[/u]

Code: Select all

session_start(); 
session_register('active'); 
session_register('username');
page B

Code: Select all

session_start();
if(session_is_registered('active')){ 
<div id="Layer4" style="position:absolute; left:798px; top:91px; width:176px; height:18px; z-index:7;">Welcome, [color=red]......called username value........ [/color]</div>
}

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]

Posted: Wed Sep 19, 2007 10:21 pm
by mrkite

Code: Select all

echo $_SESSION['username'];

Posted: Wed Sep 19, 2007 10:34 pm
by maliskoleather
session_register has been depreciated.
use:

Code: Select all

session_start();

//set the variable
$_SESSION['foo'] = 'bar';

//call the variable
echo $_SESSION['foo'];

Posted: Sat Sep 22, 2007 12:15 pm
by nhammond
and if you want to check if it is set jsut use

Code: Select all

if (isset($_SESSION['var_name'])){}