Jump to content


Photo

PHP Session variables Help


  • Please log in to reply
2 replies to this topic

#1 venky_2_2000

venky_2_2000
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 13 October 2006 - 06:07 AM

Hi Friends,

I'm new to php , Need help with PHP sessions variables.I have two pages main.php and page.php
I would like to register a session variable in main.php and would like to retirve its value in page.php
how can i do that .
Please help me with this .

Thanks,
Venky

#2 joshi_v

joshi_v
  • Members
  • PipPipPip
  • Advanced Member
  • 168 posts

Posted 13 October 2006 - 06:25 AM

Hi,

If main.php register a session variable and assign a value to it
sesssion_register("session_name");
$_SESSION["session_name"] = "Assign value";
in page.php you can access this by printing or by assigning this session variable to another variable.

echo $_SESSION["session_name"];

$some_variable=$_SESSION["session_name"];

Happy Coding :)


#3 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 13 October 2006 - 06:43 AM

Hi Friends,

I'm new to php , Need help with PHP sessions variables.I have two pages main.php and page.php
I would like to register a session variable in main.php and would like to retirve its value in page.php
how can i do that .
Please help me with this .

Thanks,
Venky


//main.php
session_start();
$_SESSION["test"] = " my message";

//page.php
session_start();
echo $_SESSION["test"];




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users