using sessions instead of cookie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 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);}

}}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux