Page 1 of 1

Printing session variable values in includes?

Posted: Tue Aug 27, 2002 11:45 am
by Rebajas
Allo,

I have a simple login on my site that works fine - however, one of the requirements of the site is to have the users nickname in the menu linked to their profile. This menu is in an include and although it changes depending on whether the user is logged in, i can't seem to print the variable:

Code: Select all

if (session_is_registered("loggedIn")) {
			?>	<h5 class="title">signed in</h5>
			you are signed in as: <span class="bold"><a href="/profiles.php?searchBy=nickName&searchKeyword=<?php print $sessionNickname; ?>"><?php print $sessionNickname; ?></a></span>
			<input type="button" class="formSubmit" value="log out" />
			<?php
		&#125;
At the top of the include i have:

Code: Select all

<?php

session_start();
Any help appreciated,

Tony.

Posted: Tue Aug 27, 2002 11:48 am
by volka
after you read Sticky: Before Post Read: Concerning Passing Variables in PHP 4.2+ try $_SESSION['<variable name>']