Page 1 of 1

Problem with sessions

Posted: Mon Jun 20, 2005 2:13 pm
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

Re: Problem with sessions

Posted: Mon Jun 20, 2005 7:16 pm
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"];
?>