Session

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
guerillacity
Forum Newbie
Posts: 7
Joined: Wed Aug 06, 2008 3:04 pm

Session

Post by guerillacity »

Hi im trying to set a session on one page and view it on another, i cant get it to work for some reason:

1st Page

Code: Select all

<?php session_start(); ?><? 
session_register( "sess_test" );
$sess_test="test";?>
2nd Page

Code: Select all

<?print " test = $sess_test <br>" ;
coder500
Forum Newbie
Posts: 20
Joined: Fri Jul 25, 2008 10:24 am
Location: Singapore

Re: Session

Post by coder500 »

$_session['sess_test']="test";
And in the second page also, start session in the beginning(we have to start session on every page we use session variables)
and use echo $_SESSION['sess_test'];
Hope this will help.
guerillacity
Forum Newbie
Posts: 7
Joined: Wed Aug 06, 2008 3:04 pm

Re: Session

Post by guerillacity »

Cheers worked like a charm, THANKS.
Post Reply