Problem with session_register

I creating session variable with this code :
  $var_x = "123456";

  print(" session_id() . "<BR>\n");
  print("Session variable is : $var_x");

I get nothing when read that variable with this code :

  print("SID : " . session_id() . "<BR>\n");
  print("Session variabel is :   <BR>\n");

SID is appear but print($var_x) doesn't print anything, What's wrong ?
Budi SantosoIT Infrastructure ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

before registering your variable, start it as well.

  $_SESSION["var_x"] = "123456";
You con't have to use session_register anymore! it may be removed from future versions of PHP so you're better of not using it anymore.

You can do it like this:

session_start(); // start the session
$_SESSION['myvariable'] = 123; // store "123" in "myvariable" in the session

on each next page you can use $_SESSION['myvariable'] to use that variable (make sure you used session_start() first!)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Budi SantosoIT Infrastructure ManagerAuthor Commented:
I had fix it myself.
The problem is in php.ini path still "/tmp"
Then I change to my local drive.

Anyway, thanks for the information.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.