ryans_85 Posted November 13, 2009 Share Posted November 13, 2009 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"); } } Quote Link to comment https://forums.phpfreaks.com/topic/181379-problem-adding-products-to-my-session-cart/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.