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


Please Help Members By Posting Answers For Below Questions

What is sticky form in php?

499


What is a persistent cookie in php?

531


Tell me what are the functions to be used to get the image's properties (size, width and height)?

540


What is the best way to avoid email sent through php getting into the spam folder?

548


What is associative array in php?

534






What is the use of die in php?

517


What is memcache?

540


What is basic php?

535


How do I repair phpmyadmin?

518


What is difference between mysql_connect and mysqli_connect?

505


How to know user has read the email-php?

495


How to get ip address of a server in php?

545


What is http get and post?

530


How to convert a string to uppercase in php?

543


Is php a low level language?

532