Jump to content

Problem adding products to my session cart


ryans_85

Recommended Posts

Hi all, I have a problem with a site im doing for a friend.  The problem is passing information through the code below to add to the shopping cart.  The script works perfectly well when my SQL command to grab the products is simply "SELECT * FROM tblProducts". When i add "WHERE cat_id = '" . $cat_id ."' then nothing gets passed to the cart. All that happens is the printed out "You did not select any items to buy.".

 

Thanks Guys if you could help me it would be fantastic.

 

if ($_REQUEST["navigate"]=="proceed"){

/** We need the user to have selected at least one item, so let's see what they've chosen **

*** by looping through the submitted Quantity fields **/

$strCart="";

$num2 = $num;

for ($iLoop=5; $iLoop <= $num2; $iLoop++) {

  $strThisQuantity=$_REQUEST["Quantity" . $iLoop];

  if ($strThisQuantity == "") $num2++;

  else

  if ($strThisQuantity>0)

  $strCart=$strCart . $strThisQuantity . ",";

}

 

if (strlen($strCart)==0){

// Nothing was selected, so simply redesiplay the page with an error

$strPageError="You did not select any items to buy. ";

$_SESSION["strCart"]="";

}

 

else  {

// Save the cart to the session object

$_SESSION["strCart"]=$strCart;

// Proceed to the view shopping basket screen

ob_end_flush();

redirect("viewBasket.php");

}

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.