How can we register the variables into a Session?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / senthilkumar g
<?
session_start();
$username=$_GET['username'];
$_SESSION['username']=$username;
session_write_close();
?>
Is This Answer Correct ? | 13 Yes | 4 No |
Answer / animesh dutta
<?php
// Start the session
session_start();
?>
<?php
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
?>
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / tarun
session_start();
$ses_variable="name";
session_register('ses_varaible');
// to access the session
echo $_SESSION['ses_variable'];
Is This Answer Correct ? | 6 Yes | 4 No |
Answer / subrat
$_SESSION[?name?] = ?Chinmay?;
To destroy a session: unset($_SESSION[?name?]);
Is This Answer Correct ? | 5 Yes | 9 No |
What is the difference between characters 34 and x34?
Tell me how is it possible to return a value from a function?
What is call by reference in php?
Do loops php?
What can php do?
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
What is get method in java?
What are the popular content management systems (cms) in php?
what is different between PHP and Asp.net?
Is runtime polymorphism overriding?
What good is polymorphism?
What is the use of php and mysql?