Jump to content

Archived

This topic is now archived and is closed to further replies.

venky_2_2000

PHP Session variables Help

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
[quote author=venky_2_2000 link=topic=111366.msg451244#msg451244 date=1160719670]
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
[/quote]

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

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.