How can we register the variables into a session?

Asked 12-Jun-2018
Viewed 961 times

1 Answer


0

PHP Session :
if you work on any application,you just open it,do some changes according to you,and close it.This whole process is much like a session.after that if you again wants to do work here than on the internet there is one problem because your application end and the web server does not know who you are and what you do even HTTP address  doesn't maintain state. it's only one time service for one user as a session variables hold information. if you need permanent storage, you may to a big database. 
<?php 
session_start(); // Starting session
$_SESSION["firstname"] = "Mind"; // Storing session data
$_SESSION["lastname"] = "Stick";
?>
you should follow these steps for your problem: 
-> session_start(); 
-> session_register(); never use this syntax only use this $_SESSION['foo'] = 'bar';
-> session_destroy();
I Hope, it will be helpful for you.
happy coding :)