Things You'll Need:
- A PHP editor...notepad will do
-
Step 1
This tutorially assumes you know a little about PHP. Open your editor. I use notepad to create my PHP files.
-
Step 2
Create a PHP file that looks like the following:
session_start()
$_SESSION['session_name'] = {some value}
Line 1 starts the session. It will automatically create a sessio id for you. If you ever need the value of the session id you can simply assign it to a variable as follows:
$sessionid=session_id()
The second line of code creates a session variable named "session_name" and assigns it the value of whatever comes after the equal sign. When you want to retrieve that value, you can write the code as follows:
$myvalue=$_SESSION['session_name'] -
Step 3
When you want to erase all of your session variables and their values use the line of code:
session_destroy()
This will not, however, allow you to create a news session id the next time the visitor hits a PHP page with the session_start() code. [I learned that the hard way].













