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

}

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.