View Single Post
  #1 (permalink)  
Old June 29th, 2003, 04:39 PM
sipb2002 sipb2002 is offline
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning PHP4 Chapter 8

Well the script for the sessions (pagecount) script works fine. Ive attempted to adapt it for a shopping cart, whihc works, you can add items to your basket, and icrements the GLOBAL that are registered for the session. The problem Im having is deleteing or rather re assigning values to the .$GLOBAL["item${itemid}"]. where $itemid is the global variable i wish to reset to "".
It works fine if i do the last item i added :D, but if you take anything else and deltete it makes all the variables after it 0 aswell, and only reduces the itemcount by 1 :(
this is what i tried to use:

<?
if($delitem=1) {
$GLOBALS["item${itemid}"]="";
$GLOBALS["itemnumber"]=($GLOBALS["itemnumber"]-1);
}
?>

where item id is the item i want to delete.

http://www.sabdesign.co.uk/gls/index.htm

will take you into the shop (items are only in shin guards and gloves)
Any tips would be really helpful? Ive even tried moving it onto a seperate page, with no success :(
Reply With Quote