Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 注意:未定义索引:数量在。。在线165_Php - Fatal编程技术网

Php 注意:未定义索引:数量在。。在线165

Php 注意:未定义索引:数量在。。在线165,php,Php,出现此错误 注意:未定义索引:第165行C:\xampp\htdocs\ecommerce\cart.php中的数量 而且,当我按下update时,购物车就会刷新。当我更新购物车并按下移除按钮并按下更新按钮时,产品不会被移除 <!DOCTYPE> <?php session_start(); include("functions/functions.php"); ?> <html> <head> <title&g

出现此错误

注意:未定义索引:第165行C:\xampp\htdocs\ecommerce\cart.php中的数量

而且,当我按下update时,购物车就会刷新。当我更新购物车并按下移除按钮并按下更新按钮时,产品不会被移除

<!DOCTYPE>




<?php
session_start();

include("functions/functions.php");

?>
<html>
    <head>
     <title> My Online Shop </title>

 <link rel="stylesheet" href="styles/style.css" media="all" />
 </head>

<body>



<div class="main_wrapper">

<div class="header_wrapper">

    <a href="index.php"><img src="images/logo3.png" /></a>
    <img src= "" /> 
</div>



<div class="menubar">

    <ul id="menu">
        <li><a href="index.php">Home</a></li>
        <li><a href="all_products.php">All Products</a></li>
        <li><a href="customer/my_account.php">My Account</a></li>
        <li><a href="#">Sign up</a></li>
        <li><a href="cart.php">Shopping Cart</a></li>
        <li><a href="#">Contact us</a></li>



    <div id="form">
        <form method="get" action="results.php" enctype="multipart/form-data">
            <input type="text" name="user_query" / >
            <input type="submit" name="search" value="Search" />
        </form>
    </div>
    </ul>
</div>

<div class="content_wrapper">

    <div id="sidebar">

        <div id="sidebar_title">Categories</div>

        <ul id="cats">

        <?php getCats();?>

        </ul>

        <div id="sidebar_title">Brands</div>

        <ul id="cats">

        <?php getBrands(); ?>


        </ul>


    </div>

    <div id="content_area">
    <?php cart(); ?>

    <div id="shopping_cart">
            <span style="float:right; font-size:18px; padding:5px; line-height:40px">


            Welcome Guest! <b style="color:yellow"> Shopping Cart </b> Total Items:<?php total_items(); ?> Total Price: <?php total_price(); ?> <a href="cart.php" style="color:yellow">Go to Cart</a>



            </span>
    </div>




        <div id="products_box">


        <form action="" method="post" enctype="multipart/form-data">

            <table align ="center" width="700px" bgcolor="skyblue">
                <tr>
                    <td colspan="5"><h2></h2></td>
                </tr>

                <tr align = "center">
                    <th>Remove</th>
                    <th>Product(s)</th>
                    <th>Quantity</th>
                    <th>Total Price</th>

                </tr>


<?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;














            ?>

                <tr align = "center">
                <td><input type="checkbox" name="remove[] value="<?php echo $pro_id; ?>"/></td>
                <td><?php echo $product_title ?><br>
                <img src="admin_area/product_images/<?php echo $product_image; ?>"  width ="60" height = "60" />
                </td>

                <td><input type= "text" size = "4" name="qty" value="<?php echo $_SESSION['qty'];?>" /> </td>
                <?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;
                }


                ?>

                <td><?php echo $single_price ?></td>

            </tr>




<?php } }?>

<tr align = "right">
            <td colspan = "4"><b>Sub Total:</b></td>
            <td colspan="4"><?php echo $total ?></td>

            </tr>

            <tr align = "center">

            <td colspan = "2"><input type ="submit" name="update_cart" value="Update Cart"/></td>
            <td><input type = "submit" name = "continue" value="Continue Shopping"/></td>
            <td><button><a href ="checkout.php" style="text-decoration:none; color:black;">Checkout</a></button></td>



            </tr>


            </table>


        </form>
        <?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 "<script>window.open('cart.php','_self')</script>";
                    }

                }



            }

        ?>


        </div>

    </div>
</div>


<div id="footer">

 <h2 style="text-align:center; padding-top:30px;">&copy; 2016 TRESTON INTERNATIONAL COLLEGE</h2>    
</div>






 </div>

 </body>
</html>

我的网上商店
类别
品牌
欢迎光临!购物车商品总数:总价: 去除 产品 量 总价
似乎您正在尝试获取此行中未定义的会话“数量”

<input type= "text" size = "4" name="qty" value="<?php echo $_SESSION['qty'];?>" />
if(empty($_SESSION['qty'])){
   $_SESSION['qty'] = 0;
}

session\u start()
必须在任何HTML内容之前-包括
doctype
声明-这是不正确的-应该是
我的问题没有得到回答