Jump to content

[SOLVED] Session PHP


TheFilmGod

Recommended Posts

put

session_start();

at the begginning of your code and then

you can store session values using

$_SESSION['name'] = "name";

$_SESSION['pass'] = "pass";

 

you can unset the session with unset($_SESSION['name']);

and put session_destroy; after the unsets

Link to comment
https://forums.phpfreaks.com/topic/38414-solved-session-php/#findComment-184259
Share on other sites

q1 //How do you create php sessions

 

http://uk.php.net/function.session-start

 

 

q2 //Also how do you hold those variables that a visitor turns on or does to the next pages he/she goes to

 

http://uk2.php.net/variables.predefined

 

 

q3// And how to stop the session

 

http://uk.php.net/function.session-destroy

http://uk.php.net/unset

 

 

 

All of the above is an insight good luck.

 

Link to comment
https://forums.phpfreaks.com/topic/38414-solved-session-php/#findComment-184264
Share on other sites

Thanks for some the info. But I had a question. How would you code a "turn off" and "turn on" switch and carry it to the next page. The pages you gave me make a lot of sense, yet I'm still totally lost.

 

<?php

session_start();

..........then what?

Link to comment
https://forums.phpfreaks.com/topic/38414-solved-session-php/#findComment-184269
Share on other sites

at the top of each page of code put the session_start(); or session will not work, unless auto session start is set in the php.ini

as long as you have the session_start(); the values that you store in the session will be available  on each page.

access the values with $name = $_SESSION['name'];

Link to comment
https://forums.phpfreaks.com/topic/38414-solved-session-php/#findComment-184271
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.