The code is as follows:
- Code: Select all
<?php
include("includes/db.php");
include("includes/functions.php");
if(isset($_REQUEST['command']) && $_REQUEST['command']=='delete' && $_REQUEST['pid']>0){
remove_product($_REQUEST['pid']);
}
else if(isset($_REQUEST['command']) && $_REQUEST['command']=='clear'){
unset($_SESSION['cart']);
}
else if(isset($_REQUEST['command']) && $_REQUEST['command']=='update'){
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=intval($_REQUEST['product'.$pid]);
if($q>0 && $q<=999){
$_SESSION['cart'][$i]['qty']=$q;
}
else{
$msg='Some products not updated!, quantity must be a number between 1 and 999';
}
}
}
?>
From what I know of php, the isset should stop the error message from displaying as there is no msg to display if the basket is populated. I'm still getting an error though and I'm tearing my hair out trying to find what I've got wrong.
Please help! Thanks



