How can we register the variables into a Session?
Answer Posted / ramesh n
If you want to register a username as a session variable
means, There are 3 ways done in a job
First way
session_start();
$username=$_GET['username'];
session_register('username');
Second Way
session_start();
$username=$_GET['username'];
$HTTP_SESSION_VARS['username']=$username;
Third Way
session_start();
$username=$_GET['username'];
$_SESSION['username']=$username;
| Is This Answer Correct ? | 53 Yes | 5 No |
Post New Answer View All Answers
What is data structure in php?
What is the difference between array_map () and array_shift ()?
What is session in c#?
What is the best practice for running mysql queries in php? Consider the risk of sql injection.
What is a definer in mysql?
What is $_ get and $_ post in php?
What is csrf token and how it works?
Tell me how to retrieve a cookie value?
How come the code works, but doesn’t for two-dimensional array of mine?
How to get the ip address of the client?
Explain the difference between mysql_connect and mysql_pconnect?
Tell me what is the difference between get and post?
How to include variables in double-quoted strings in php?
How to remove white spaces from the beginning and/or the end of a string in php?
What is the main difference between require() and include()?