Jump to content

PHP Session variables Help


venky_2_2000

Recommended Posts

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 :)
Link to comment
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"];
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.