This question already has an answer here:
Notice: Undefined index: qty in C:\xampp\htdocs\ecommerce\cart.php on line 130
Notice: Use of undefined constant qty - assumed 'qty' in C:\xampp\htdocs\ecommerce\cart.php on line 137
<?php
if(isset($_POST['update_cart'])){ //line 128
$qty =$_POST['qty'];
$update_qty ="update cart set qty='$qty'";
$run_qty =mysqli_query($con, $update_qty);
$_SESSION ['qty']=$qty;
$total=$total*qty; //line 137
}
?>
</div>
you forgot $ before qty in line 137 and seems like $_POST['qty'] is empty
$total=$total*qty;
suppost to be
$total=$total*$qty;
fixed version:
if(isset($_POST['update_cart'])){
$qty =$_POST['qty'];
$update_qty ="update cart set qty='$qty'";
$run_qty =mysqli_query($con, $update_qty);
$_SESSION ['qty']=$qty;
$total=$total*&qty;
}
hope it helps
here is the proper way to concat strings. You are missing a $ and assigning a variable for qty is totaly useless.
if (isset($_POST['update_cart']) !==false) {
$update_qty = 'update cart set qty="' . $_POST['qty'] . '"';
$run_qty = mysqli_query($con, $update_qty);
$_SESSION ['qty'] = $_POST['qty'];
$total = ($total * floatval($_POST['qty']));
}