i tried creating a session variable.
Wht r necessary steps to do..
i tried with the following..
session_start();
session_register ("my_username");
$my_username = $credentials['username'];
//here $credentials['username'] will display the actual username
Now i want to use ths username in other file.
so i tried
session_start();
session_register ("my_username");
echo"hello";
echo $_SESSION['my_username'];
i also tried $my_usename;
nothing is wrking
the variable is null and not displaying anuthg.
Pls helpppp...
session variable
Moderator: General Moderators
Re: session variable
http://us2.php.net/manual/en/function.s ... gister.php
Please, use [ php ] your code here [ /php ] tags as you've been asked to already.Warning
This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.
There are 10 types of people in this world, those who understand binary and those who don't
Re: session variable
Which would mean
is enough and you can do echo on the next page.
Code: Select all
<?php
session_start();
$_SESSION["my_username"] = "test";
?>Code: Select all
$_SESSION["my_username"];