Problem with sessions

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

Post Reply
Cobra
Forum Newbie
Posts: 1
Joined: Mon Jun 20, 2005 2:07 pm

Problem with sessions

Post by Cobra »

Hi.

There seems to be a problem somewhere along the lines because it looks like my sessions arent working at all. For testing my scripts to make sure it wasnt them i used a tutorial on sessions, the code was as follows:

page1.php

Code: Select all

<?php
// page1.php
session_start();
$_SESSION&#1111;&quote;real_name&quote;] = &quote;Hermawan Haryanto&quote;;
session_register(&quote;real_name&quote;);
print &quote;<a href='page2.php'>Go to this page</a>&quote;;
?>
page2.php

Code: Select all

<?php
// page2.php
session_start();
print $_SESSION&#1111;&quote;real_name&quote;];
?>
Do you have any suggestions i could try to get this to work?

Im using the "Dev5Beta3" bundle from firepages and im running XP Pro (using apache1 too because they said 2 was unstable.

thanks for any help you may be able to give
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Problem with sessions

Post by Chris Corbyn »

page1.php

Code: Select all

<?php
// page1.php
session_start();
$_SESSION["real_name"] = "Hermawan Haryanto";
//session_register("real_name"); <----- deprecated, don't use if you used session_start()
print "<a href='page2.php?".SID."'>Go to this page</a>"; //Append session ID (constant `SID`)
?>
page2.php

Code: Select all

<?php
// page2.php
session_start();
print $_SESSION["real_name"];
?>
Post Reply