Link to home
Start Free TrialLog in
Avatar of Budi Santoso
Budi SantosoFlag for Indonesia

asked on

Problem with session_register

I creating session variable with this code :
<?php
  session_register("var_x");
  $var_x = "123456";

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

I get nothing when read that variable with this code :
<?php
  session_start();

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

SID is appear but print($var_x) doesn't print anything, What's wrong ?
Thanks.
Avatar of errows
errows

before registering your variable, start it as well.

<?php
  session_start();
  session_register("var_x");
  $_SESSION["var_x"] = "123456";
ASKER CERTIFIED SOLUTION
Avatar of DoppyNL
DoppyNL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Budi Santoso

ASKER

I had fix it myself.
The problem is in php.ini
session.save path still "/tmp"
Then I change to my local drive.

Anyway, thanks for the information.