数量增加或减少时,总计应该放什么?请帮助我

问题描述 投票:0回答:0
  1. 数量增加或减少时,总计应该放什么?我想发生当用户点击数量增加时总数也增加。我尝试了一些 javascript,但它似乎不起作用。不知道放什么

  2. Here is the image。然后这是我在 order.php 中的代码块:

             <?php
             include("functions.php");
             include("footer.php");
    
             global $lastname,$firstname,$address,$email,$contactno,$username,$customer_id;
    
             $id = initObj('id');
             $custom_text = initObj('custom_text');
    
             if ($sess_username!="") {
                 $sql = "select * from customers where username='$sess_username'";
                 $row = getRow($sql);
                 $customer_id = $row['id'];
                 $lastname = $row['lastname'];
                 $firstname = $row['firstname'];
                 $address = $row['address'];
                 $email = $row['email'];
                 $contactno = $row['contactno'];
             }
    
             fHeader();
             ?>
             <div class="container mt-4">
                 <h3>Order Form</h3>
                 <div class="row mt-4">
                     <div class="col-md-10">
                         <!--products-->
                         <div class="row">
                             <?php
                             $sql = "select * from products where id=$id";
                             $row = getRow($sql);
                             $prodcode = $row['prodcode'];
                             $prodname = $row['prodname'];
                             $proddesc = $row['proddesc'];
                             $prodimage = chkPic("product",$prodcode);
                             $total = $row['price'];
                             $custom_image = chkPic("order",genTransNo("N",$uid));
                             ?>
                             <div class="col-md-5">
                                 <div class="card" align="center" style="overflow: hidden;">
                                     <center>
                                     <!-- <img src="<?=$prodimage?>" class="card-img-top" alt="<?=$prodname?>"> -->
                                     <div style="width:400px; height:468px; margin-left: -10px; background-image: url(<?=$prodimage?>?v=<?=time()?>); background-size:400px 468px;">
                                         <center>
                                             <img src="<?=$custom_image?>?v=<?=time()?>" style="margin-top:150px;" width="40%" height="40%"><br>
                                             <label style="margin-top:10px; font-size:20px; font-weight:bold;"><?=$custom_text?></label>
                                         </center>
                                     </div>
                                     <div class="card-body">
                                         <h5 class="card-title"><?=$prodname?></h5>
                                         <p class="card-text"><?=$proddesc?></p>
                                     </div>
                                     </center>
                                 </div>
                             </div>
                             <div class="col-md-7">
                                 <form name="frm" method="post" action="confirm.php" role="form" enctype="multipart/form-data">
                                     <div class="box-body">
                                         <table width="100%" border="0" cellspacing="2" cellpadding="2">
                                             <tr>
                                                 <td colspan="2"><label class="h3">Customer Information</label>
                                                 <?php if ($sess_username=="") { ?>
                                                 <span style="margin-top:10px; float:right">Already have an account? <a href="login.php?id=<?=$id?>">Login</a></span>
                                                 <?php } ?>
                                             </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Last Name</b></td>
                                                 <td width="80%">
                                                     <div class="col-md-12"><input name="lastname" type="text" class="form-control" value="<?=$lastname?>" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>First Name</b></td>
                                                 <td width="80%">
                                                     <div class="col-md-12"><input name="firstname" type="text" class="form-control" value="<?=$firstname?>" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Address</b></td>
                                                 <td width="80%">
                                                     <div class="col-md-12"><input name="address" type="text" class="form-control" value="<?=$address?>" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Email</b></td>
                                                 <td width="80%">
                                                     <div class="col-md-12"><input name="email" type="text" class="form-control" value="<?=$email?>" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Contact No.</b></td>
                                                 <td width="80%">
                                                     <div class="col-md-12"><input name="contactno" type="text" class="form-control" value="<?=$contactno?>" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Remarks</b></td>
                                                 <td width="80%">
                                                     <div class="col-md-12"><input name="remarks" type="text" class="form-control" value=""></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Custom Text</b></td>
                                                 <td width="80%">
                                                     <div class=""><input name="custom_text" type="text" class="form-control" value="" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Custom Text Back</b></td>
                                                 <td width="80%">
                                                     <div class=""><input name="custom_text_back" type="text" class="form-control" value="" required></div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Custom Text Sleeves</b></td>
                                                 <td width="80%">
                                                     <div class=""><input name="custom_text_sleeves" type="text" class="form-control" value="" required></div>
                                                 </td>
                                             </tr>
                                             <tr height="40">
                                                 <td width="20%"><b>Custom Image</b></td>
                                                 <td width="80%">
                                                     <input name="file" type="file" required><br>
                                                     <!-- <img id="custom_image" src="<?=$custom_image?>?v=<?=time()?>" class="my-2" width="30%" height="30%"> -->
                                                 </td>
                                             </tr>
                                             <tr height="40">
                                                 <td width="20%"><b>Custom Image Back</b></td>
                                                 <td width="80%">
                                                     <input name="back" type="file" required><br>
                                                     <!-- <img id="custom_image" src="<?=$custom_image_back?>?v=<?=time()?>" class="my-2" width="30%" height="30%"> -->
                                                 </td>
                                             </tr>
                                             <tr height="40">
                                                 <td width="20%"><b>Custom Image Sleeves</b></td>
                                                 <td width="80%">
                                                     <input name="sleeves" type="file" required><br>
                                                     <!-- <img id="custom_image" src="<?=$custom_image_sleeves?>?v=<?=time()?>" class="my-2" width="30%" height="30%"> -->
                                                 </td>
                                             </tr>
                                             <tr>
                                             <td width="15%"><b>Quantity</b></td>
                                             <td width="85%">
                                                 <div class="col-md-2"><input name="qty" type="number" class="form-control" value="" required></div>
                                             </td>
                                             </tr>
                                             <tr>
                                                 <td width="20%"><b>Total</b></td>
                                                 <td width="80%">
                                                     <div class=""><input name="total" type="text" class="form-control" value="<?=$total?>" readonly></div>
                                                 </td>
                                             </tr>
                                         </table>
                                     </div>
                                     <div class="box-footer mt-3">
                                         <input name="product_id" type="hidden" value="<?=$id?>">
                                         <input name="item" type="hidden" value="<?=$prodname?>">
                                         <input name="customer_id" type="hidden" value="<?=$customer_id?>">
                                         <button name="action" value="save" type="submit" class="btn bgclrCyan">Confirm Order</button>
                                     </div>
                                 </form>
                             </div>
                         </div>
                     </div>
                 </div>
             </div>
             <?php Pfooter(); ?>
             <script src="js/lightbox-plus-jquery.min.js"></script>
                 <script>
                 $("#headerLogo").click(function(){
                     window.location.href="index.php";
                 })
             </script> 
    
e-commerce shopping-cart product-quantity
© www.soinside.com 2019 - 2024. All rights reserved.