1,105,281 Community Members

Session

Member Avatar
Shahbaz_2
Newbie Poster
5 posts since Jan 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am new in web and PHP

want to learn about session... how they are made on login... and how they are carried to next page...

i know to make database and queries..

Member Avatar
minitauros
Practically a Master Poster
606 posts since Apr 2011
Reputation Points: 67 [?]
Q&As Helped to Solve: 105 [?]
Skill Endorsements: 6 [?]
 
1
 

You start a session with session_start(). That should probably be one of the first lines, if not the first line, of any of your files in which you want to use the session.

Then, after starting the session, you can save values to it or retrieve values from it, using $_SESSION. E.g.:

Page 1:

<?php
session_start();
$_SESSION['test'] = 'hello';

Page 2:

<?php
session_start();
echo '<p>The session value for test is now: ' . $_SESSION['test'] . '</p>';

Hope that helps a bit ;). If not, have you tried searching Google for tutorials on PHP sessions?

Member Avatar
Shahbaz_2
Newbie Poster
5 posts since Jan 2014
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Oh.. Thanks a lot respected..... it worked out for me... thanks again..

Question Answered as of 3 Months Ago by minitauros
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: