title: How to update shopping cart quantity with amount in php?
body: <p>Below is my not working source code? I want to update the quantity with respective to that perticular item and calculating total. I was stuck or did wrong coding. Please can anyone tell me what to do furture ? means when user increasing quantity price of that item should be incremented..            </p>
  
  <pre><code>         $sel_user = "select * from cart where ip_add = '$ip' ";
  
              $run_sel_user = mysqli_query($con,$sel_user);
  
              while($p_price = mysqli_fetch_array($run_sel_user))
              {
                  $pro_id = $p_price['p_id'];
  
                  $sel_pro_from_product = "select * from products where product_id = '$pro_id'";
  
                  $run_pro_from_product = mysqli_query($con,$sel_pro_from_product);
  
                  while($pro_price = mysqli_fetch_array($run_pro_from_product))
                  {
  
                      $product_price = array($pro_price['product_price']);
  
                      $product_title = $pro_price['product_title'];
  
                      $product_image = $pro_price['product_img1'];
  
                      $product_single_price = $pro_price['product_price'];
  
                      $values = array_sum($product_price);
  
                      $total += $values ;
                      if(isset($_POST['update_cart']))
                      {
                          if(isset($_POST['qty']))
                          {
                              print_r($_POST['qty']);
                              foreach($_POST['qty'] as $qty_add)
                              {
  
                                  $qty = $qty_add;
                                  $update_qty = "update cart set qty='$qty' where p_id='$pro_id'";
                                  $run_qty = mysqli_query($con,$update_qty);
                                  $total=$total*$qty;
                              }
                          }
                          else
                          {
  
                          }
                      }
  
              ?&gt;
              &lt;tr align="center" &gt;
                  &lt;td style="padding:5px; border:1px solid black;"&gt;&lt;input type="checkbox" name="remove[]" value="&lt;?php echo $pro_id;?&gt;"/&gt;&lt;/td&gt;
  
                  &lt;td style="padding:5px; border:1px solid black;"&gt;&lt;?php echo $product_title;?&gt;&lt;br&gt;
                      &lt;img src="admin_area/product_images/&lt;?php echo $product_image; ?&gt;" height="60" width="60"/&gt;
                  &lt;/td&gt;
                  &lt;td style="padding:5px; border:1px solid black;"&gt;&lt;input type="text" size="4" name="qty[]" 
                      value="&lt;?php
                              $default_qty = 1;
                              if(!isset($_POST['qty']))
                              {
                                  echo $default_qty;
                              }
  
  
                      ?&gt;" style="text-align:center;"/&gt;&lt;/td&gt;
  
  
                          &lt;td style="padding:5px; border:1px solid black;"&gt;&lt;?php echo $product_single_price." Rs ";?&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;?php   
                  }}
  
                      ?&gt;
  </code></pre>