View Full Version : Saving Information In PHP.


Chaos_Blader
07-25-2005, 12:59 PM
I made a script and someone said to try and use session or cookies I don't know what those are or where to start lets say I want to name the varibles

var1 = 0
var2 = 1

How would I save them?

Sphere
07-25-2005, 06:51 PM
I made a script and someone said to try and use session or cookies I don't know what those are or where to start lets say I want to name the varibles

var1 = 0
var2 = 1

How would I save them?

start your page with:

session_start();

then you can save normal variables to session variables with

$var1 = $_SESSION['var1'];

on every page you want to use this variable start it with session_start();

to stop a session use session_destroy(); to delete them

bejayel
07-25-2005, 06:56 PM
basically a session uses your computer for the sessions, whereas a cookie is placed on the users computer. If you are expecting some amount of traffic, i would use cookies (unless you got a powerful computer).

try a google for "using cookies in php"

also, for permanently saving information you would need some sort of database.