|
Posted by James Benson on 01/21/06 17:55
http://php.net/manual/en/ref.session.php
Ross wrote:
> 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);}
>
> }}
--
---------------------------------------------------------
http://www.ciwcertified.com - Master CIW Designer
http://www.zend.com - Zend Certified Engineer
http://www.jamesbenson.co.uk
---------------------------------------------------------
Navigation:
[Reply to this message]
|