title: Notice: Undefined index: qty in.. on line 165
body: <p>this error appears</p>
  
  <blockquote>
    <p><b>Notice</b>:  Undefined index: qty in <b>C:\xampp\htdocs\ecommerce\cart.php</b> on line <b>165</b></p>
  </blockquote>
  
  <p>and also when i press update the cart just refreshes. its when i'm updating cart and pressing remove button and press the update the product is not removed</p>
  
  <pre><code>&lt;!DOCTYPE&gt;
  
  
  
  
  &lt;?php
  session_start();
  
  include("functions/functions.php");
  
  ?&gt;
  &lt;html&gt;
      &lt;head&gt;
       &lt;title&gt; My Online Shop &lt;/title&gt;
  
   &lt;link rel="stylesheet" href="styles/style.css" media="all" /&gt;
   &lt;/head&gt;
  
  &lt;body&gt;
  
  
  
  &lt;div class="main_wrapper"&gt;
  
  &lt;div class="header_wrapper"&gt;
  
      &lt;a href="index.php"&gt;&lt;img src="images/logo3.png" /&gt;&lt;/a&gt;
      &lt;img src= "" /&gt; 
  &lt;/div&gt;
  
  
  
  &lt;div class="menubar"&gt;
  
      &lt;ul id="menu"&gt;
          &lt;li&gt;&lt;a href="index.php"&gt;Home&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="all_products.php"&gt;All Products&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="customer/my_account.php"&gt;My Account&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;Sign up&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="cart.php"&gt;Shopping Cart&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;Contact us&lt;/a&gt;&lt;/li&gt;
  
  
  
      &lt;div id="form"&gt;
          &lt;form method="get" action="results.php" enctype="multipart/form-data"&gt;
              &lt;input type="text" name="user_query" / &gt;
              &lt;input type="submit" name="search" value="Search" /&gt;
          &lt;/form&gt;
      &lt;/div&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;div class="content_wrapper"&gt;
  
      &lt;div id="sidebar"&gt;
  
          &lt;div id="sidebar_title"&gt;Categories&lt;/div&gt;
  
          &lt;ul id="cats"&gt;
  
          &lt;?php getCats();?&gt;
  
          &lt;/ul&gt;
  
          &lt;div id="sidebar_title"&gt;Brands&lt;/div&gt;
  
          &lt;ul id="cats"&gt;
  
          &lt;?php getBrands(); ?&gt;
  
  
          &lt;/ul&gt;
  
  
      &lt;/div&gt;
  
      &lt;div id="content_area"&gt;
      &lt;?php cart(); ?&gt;
  
      &lt;div id="shopping_cart"&gt;
              &lt;span style="float:right; font-size:18px; padding:5px; line-height:40px"&gt;
  
  
              Welcome Guest! &lt;b style="color:yellow"&gt; Shopping Cart &lt;/b&gt; Total Items:&lt;?php total_items(); ?&gt; Total Price: &lt;?php total_price(); ?&gt; &lt;a href="cart.php" style="color:yellow"&gt;Go to Cart&lt;/a&gt;
  
  
  
              &lt;/span&gt;
      &lt;/div&gt;
  
  
  
  
          &lt;div id="products_box"&gt;
  
  
          &lt;form action="" method="post" enctype="multipart/form-data"&gt;
  
              &lt;table align ="center" width="700px" bgcolor="skyblue"&gt;
                  &lt;tr&gt;
                      &lt;td colspan="5"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  
                  &lt;tr align = "center"&gt;
                      &lt;th&gt;Remove&lt;/th&gt;
                      &lt;th&gt;Product(s)&lt;/th&gt;
                      &lt;th&gt;Quantity&lt;/th&gt;
                      &lt;th&gt;Total Price&lt;/th&gt;
  
                  &lt;/tr&gt;
  
  
  &lt;?php
  
  
  $total = 0;
  
  global $con;
  
  $ip = getIp();
  
  $sel_price="select *from cart where ip_add='$ip'";
  
  $run_price = mysqli_query($con, $sel_price);
  
  while($p_price = mysqli_fetch_array($run_price)){
  
      $pro_id = $p_price['p_id'];
  
      $pro_price = "select * from products where product_id='$pro_id'";
  
      $run_pro_price = mysqli_query($con, $pro_price);
  
      while($pp_price = mysqli_fetch_array($run_pro_price)){
  
          $product_price = array($pp_price['product_price']);
  
          $product_title = $pp_price['product_title'];
  
          $product_image = $pp_price['product_image'];
  
          $single_price = $pp_price['product_price'];
  
          $values = array_sum($product_price);
  
          $total += $values;
  
  
  
  
  
  
  
  
  
  
  
  
  
  
              ?&gt;
  
                  &lt;tr align = "center"&gt;
                  &lt;td&gt;&lt;input type="checkbox" name="remove[] value="&lt;?php echo $pro_id; ?&gt;"/&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $product_title ?&gt;&lt;br&gt;
                  &lt;img src="admin_area/product_images/&lt;?php echo $product_image; ?&gt;"  width ="60" height = "60" /&gt;
                  &lt;/td&gt;
  
                  &lt;td&gt;&lt;input type= "text" size = "4" name="qty" value="&lt;?php echo $_SESSION['qty'];?&gt;" /&gt; &lt;/td&gt;
                  &lt;?php
                  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;
                  }
  
  
                  ?&gt;
  
                  &lt;td&gt;&lt;?php echo $single_price ?&gt;&lt;/td&gt;
  
              &lt;/tr&gt;
  
  
  
  
  &lt;?php } }?&gt;
  
  &lt;tr align = "right"&gt;
              &lt;td colspan = "4"&gt;&lt;b&gt;Sub Total:&lt;/b&gt;&lt;/td&gt;
              &lt;td colspan="4"&gt;&lt;?php echo $total ?&gt;&lt;/td&gt;
  
              &lt;/tr&gt;
  
              &lt;tr align = "center"&gt;
  
              &lt;td colspan = "2"&gt;&lt;input type ="submit" name="update_cart" value="Update Cart"/&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type = "submit" name = "continue" value="Continue Shopping"/&gt;&lt;/td&gt;
              &lt;td&gt;&lt;button&gt;&lt;a href ="checkout.php" style="text-decoration:none; color:black;"&gt;Checkout&lt;/a&gt;&lt;/button&gt;&lt;/td&gt;
  
  
  
              &lt;/tr&gt;
  
  
              &lt;/table&gt;
  
  
          &lt;/form&gt;
          &lt;?php
              $ip = getIp();
  
  
              if(isset($_POST['update_cart'])){
  
                  foreach($_POST['remove'] as $remove_id){
  
                      $delete_product = "delete from cart where p_id = '$remove_id' AND ip_add='$ip'";
  
                      $run_delete = mysqli_query($con, $delete_product);
  
                      if($run_delete){
  
                          echo "&lt;script&gt;window.open('cart.php','_self')&lt;/script&gt;";
                      }
  
                  }
  
  
  
              }
  
          ?&gt;
  
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;div id="footer"&gt;
  
   &lt;h2 style="text-align:center; padding-top:30px;"&gt;&amp;copy; 2016 TRESTON INTERNATIONAL COLLEGE&lt;/h2&gt;    
  &lt;/div&gt;
  
  
  
  
  
  
   &lt;/div&gt;
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>thank you for your help :)</p>