Hey guys i seen this script in a tutorial but he never explain how this script function $_SESSION how can i use this script in a project or in any situation. can anyone elaborate this code

Recommended Answers

All 3 Replies

You can use session variables in many many situations.
for eg. i have used them for -
1. storing user's details (like name) after login in a session variable, then i can display username on each page of website.

$_SESSION['username']='XYZ';//this is not actual code

2. storing questions & answers for a quiz. Through JavaScript then i make ajax calls for checking user's response.

That said you may end up using them in every website you make.


thx for helping me guys i appreciated all ur answer...for now i try to use that variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.