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 does explode do in php?
Tell me what is mean by an associative array?
Why laravel is the best php framework in 2019?
What is the most common http method?
Are php variables global?
Difference between array_combine and array_merge?
Explain what is the difference between $var and $$var?
What is csrf token and how will you add csrf token in ajax?
How to convert strings to numbers in php?
How to create a session? How to set a value in session? How to remove data from a session?
What is difference between compile time and run time polymorphism?
Why do we use inheritance in php?
Explain how does one prevent the following warning ‘warning: cannot modify header information – headers already sent' and why does it occur in the first place?
What is compact function php?
How do I run php?