我已經(jīng)使用sql,html和php創(chuàng)建了一個購物車網(wǎng)站。購物車按鈕如下:<form method="post" action="cart.php" class="form-inline"><input type="hidden" value="' . $product['id'] . '" name="product_id"><input type="hidden" value="add_to_cart" name="add_to_cart"><button type="submit" name="id" value="12" class="btn btn-primary">Add to Cart</button></form>這是我的購物車外觀:<div class="card"> <h5 class="card-header">My Cart</h5> <div class="card-body"> <?php if(isset($_SESSION['shopping_cart']) && count($_SESSION['shopping_cart']) > 0) { $entertainment = $_SESSION['shopping_cart']; echo ' <table class="table table-hover table-bordered"> <thead> <tr> <th scope="col">#</th> <th scope="col">Title</th> <th scope="col">Quantity</th> <th scope="col">Price</th> <th scope="col" width="100">Action</th> </tr> </thead>'; $item_number = 1; $total = 0; foreach ($entertainment as $product) { echo ' <tbody> <tr> <th scope="row">'. $item_number .'</th> <td>' . $product['title'] . '</td> <td>'.$product['quantity'].'</td> <td>$ '. $product['offer_price_corporate_artist']. '</td> <td>問題是,當我向購物車中添加商品時,我可以顯示標題和購物車。但是我無法顯示價格,該價格的字段名稱在我的數(shù)據(jù)庫中為offer_price_corporate_artist。誰能告訴我我所缺少的。
數(shù)據(jù)庫中的值未出現(xiàn)在php中
元芳怎么了
2021-05-05 14:20:02