Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Shop Cart App Code


Message #1 by cullan.crothers@w... on Mon, 26 Mar 2001 22:39:10
Dear PtoP:

Here is the code I am trying to make work from the changing quantities part of the  Pro PHP
Programming book's shopping  cart. This is to go with the other email that I just sent. I 
thought it may help. I just can't get my quantities to change from 1 to anything else. I have 
tried the book examples and downloaded the code also. Here is the downloaded code I am 
trying to make work. -------->>>>>>

<?php
require 'functions.php';

if ($button == "Change Quantity !!") 
{
   $index =0;
   for($i=0;$i<$total_items;$i++) {
   $tmp = "qty".$i ;
      if ($$tmp == "0")
         continue ;
      else {
         $items_tray[$index] = $items_tray[$i] ;
         $quantity[$index] = $$tmp ;
         $index++ ;
      }
   }
   // Set the Cookie
   for($i=0; $i < $index; $i++){
      setcookie("quantity[$i]",$quantity[$i]);
      setcookie("items_tray[$i]",$items_tray[$i]);
   }
   setcookie("total_items",$index);
   header("Location:http://$HTTP_HOST/$DOCROOT/display.php");
   exit();
}
else {
   header("Location:http://$HTTP_HOST/$DOCROOT/confirm_order.php");
   exit();
}

?>


Cullan Crothers
cullan.crothers@w...

  Return to Index