Here's what you need:

on page 1.php:

<?php
session_start();
$temp = 'someValue';
session_register("temp");
?>

on page 2.php:

<?php
session_start();
print $temp; /* PHP sets the variables back the way they were for you! */
?>

You have to register the variable with the session first so it knows that
it's a variable that needs monitored and, when the script finishes, needs
saved.

Hope this helps!

Lewis

"Anjali Kaur" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i want to access some variables generated in one page
> in all the other pages, so i thought of using
> $_SESSION.
>
> what i did is :
>
> in page1.php i do:
>
>    $temp = 'someValue';
>    session_start();
>    $_SESSION['abc'] = $temp;
>
>
> in page2.php :
>
> session_start();
> echo($_SESSION['abc']);
>
>
> but i am not able to get the value of abc.
>
> please help me out. i went thru the documentation
> online but cudnt grasp much as to where i am going
> wrong.
>
> thank you.
> anjali.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to