
<?php //Starting a session session_start(); //Storing values to session $_SESSION['first_name']='Santosh'; $_SESSION['last_name']='Tewari'; //Accessing values from session $fname=$_SESSION['first_name']; $sname=$_SESSION['last_name']; echo $fname . " " . $sname; ?>The session must be started at the very beginning of a php code block. $_SESSION[] is a global array that maintains information about all session objects. You can store and access values from session by using this global array.
Feel free to share your ideas in the comments below.
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.