You are here: using sessions instead of cookie « PHP « IT news, forums, messages
using sessions instead of cookie

Posted by "Ross" on 01/21/06 13:47

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

}}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация