Glaanieboy
OSNN Veteran Addict
- Joined
- 6 Mar 2002
- Messages
- 2,628
According to many PHP manuals on the net, this should work:
What I want to do, is first get $user (with $_GET) from the address line with session.php?user=Glaanieboy. Next I want to register $user to the current session, so the variable $user will still contain the value of "Glaanieboy", just like session were invented for. But for some reason, this above code won't work.
It works when I use ?user=Glaanieboy, but when I leave the ?(etc) bit away, it prints nothing. Why? I have registered $user, right?
I remember doing this ages ago, but unfortunately I deleted the files in question.
Code:
session_start();
$user = $_GET['user'];
session_register("user");
print $user;
What I want to do, is first get $user (with $_GET) from the address line with session.php?user=Glaanieboy. Next I want to register $user to the current session, so the variable $user will still contain the value of "Glaanieboy", just like session were invented for. But for some reason, this above code won't work.
It works when I use ?user=Glaanieboy, but when I leave the ?(etc) bit away, it prints nothing. Why? I have registered $user, right?
I remember doing this ages ago, but unfortunately I deleted the files in question.