using sessions instead of cookie

From: Date: Sat, 21 Jan 2006 11:47:27 +0000
Subject: using sessions instead of cookie
Groups: php.general 
Request: Send a blank email to php-general+get-229008@lists.php.net to get a copy of this message
I have never used sessions before. How do I change the follow from COOKIES to SESSIONS in php (I do not know how to set a session)... At present the script uses an iframe with cookies but I believe if I use sessions I can leave out the iframe. http://www.ecurry.net/menu.phps http://www.ecurry.net/order2.phps The scipt adds a name and count to the cookie array, then works out the total using the order2 script. if (isset($add)){ ${$food} = intval($_COOKIE['cookie'][$food]); ob_clean(); $new= $$food+1; include('names.php'); setcookie("cookie[$food]", "$new $name"); } ; if (isset($minus)){ ${$food} = intval($_COOKIE['cookie'][$food]); if (${$food} == 0) { } else {; ob_clean(); $new= $$food-1; include('names.php'); setcookie("cookie[$food]", "$new $name"); } } and the order2 script... if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name => $quantity) { if ($name == "pakora") {$sub_total = $sub_total + ($priceA * $quantity); $pricecode= $priceA; check_zero($quantity, $pricecode);} if ($name == "haggis_fritter") {$sub_total = $sub_total + ($priceB * $quantity); $pricecode= $priceB;check_zero($quantity, $pricecode);} }}

« previous php.general (#229008) next »