=0) { if($Item[$CT]==$crtid) //crtid comes from Book_view Page(This transfers the item_id) { $amt=$Quantity[$CT]+$amt; $Quantity[$CT]=$amt; $check=1; } $CT=$CT-1; //Iterate Loop and terminate when CT=-1 } if($check==0) { $Quantity[$Counter]=$amt; $Item[$Counter]=$crtid; $Counter=$Counter+1; } $check=1; ?>