PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
SAPHP
Forum Newbie
Posts: 1 Joined: Fri Sep 02, 2005 8:42 am
Post
by SAPHP » Fri Sep 02, 2005 8:47 am
Hi
i want to use SESSION Variables but i cant get the Variable Value
on other Pages.
here is my code:
Page 1:
Code: Select all
<?PHP
session_start();
$name = "John";
$_SESSION["name"] = $name;
print("Please Visite <a href=\"./mysession.php\">This</a> Link.");
?>
Page 2:
Page 2 Do not Print Anything!
whats the Problem?
Burrito: Please use php tags when Posting Code In The Forums
Skittlewidth
Forum Contributor
Posts: 389 Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK
Post
by Skittlewidth » Fri Sep 02, 2005 8:52 am
Page two needs to have session_start(); at the top as well to continue the session:
Code: Select all
<?php
session_start();
echo $_SESSION['name'];
?>