how to update quantity to calculate total price from price in php

Solutions on MaxInterview for how to update quantity to calculate total price from price in php by the best coders in the world

showing results for - "how to update quantity to calculate total price from price in php"
Adnan
04 Jun 2018
1<?php
2	$pro_id = $_COOKIE['product_id'];   
3	$pro_id = explode(',', $pro_id);
4	$qua = 1;
5	foreach ($pro_id as $val) {
6		$ans = "SELECT * FROM wm_products WHERE pro_id='$val'";
7		$result = $conn->query($ans);
8		while($row = $result->fetch_assoc()){
9		?>
10			<tr class="cart_item">
11				<td>
12					<a href="single-product.html"><img src="products_images/<?php echo $row['pro_img']; ?>" alt="" width="180" height="180"></a>
13				</td>
14				<td>
15					<a href="single-product.html"><?php echo $row['pro_name']; ?></a>
16				</td>
17				<td>
18					<span class="amount">Rs. <?php echo $row['pro_price']; ?></span>
19				</td>
20				<td>
21					<div class="quantity buttons_added">
22					<form action="" method="post">
23						<input type="submit" class="minus" name="minus" value="-">				
24						<input type="text" size="4" class="input-text qty text" title="Qty" value="<?php echo $qua;?>" name="" max="29" min="0" step="1" >
25						<input type="submit" class="plus" name="plus" value="+">
26					</form>					
27					</div>
28				</td>
29				<td>
30					<span class="amount">Rs. <?php echo number_format($row['pro_price'] * $qua); ?></span>
31				</td>
32				<td>
33					<a class="remove remove_cart" href="#" dataid="<?php echo $row['pro_id']; ?>">×</a>
34				</td>
35			</tr>
36		<?php 
37		}                                   
38	}
39?>