Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.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 微型添加到购物车编码_Php_Html_Mysqli - Fatal编程技术网

Php 微型添加到购物车编码

Php 微型添加到购物车编码,php,html,mysqli,Php,Html,Mysqli,我正在创建一个迷你购物车,在那里我显示了我的商品和商品的数量,我想将我的产品价格添加到数量中,我如何做到这一点? 我的代码是 enter code here <?php Include_once("connection.php"); ?> <form action="view.php" action ="GET"> <div align="center"> <table align="center" border="2" width= 70%&g

我正在创建一个迷你购物车,在那里我显示了我的商品和商品的数量,我想将我的产品价格添加到数量中,我如何做到这一点? 我的代码是

enter code here

<?php
Include_once("connection.php");



?>
<form action="view.php" action ="GET">
<div align="center">
<table align="center" border="2" width= 70%>
<tr>
<th>Product Name</th>
<th>Product Price</th>
<th>Image</th>
<th>Quantity</th>
<th>Total</th>
</tr>


<?php
$view = mysqli_query($connection, "select * from `add_cart`");
$afshan=mysqli_fetch_assoc($view);
if($afshan)
{
?>
 <td><?php echo $afshan['name']?></td>
<td><?php echo $afshan['price']?></td>
<td><img width="50px" height="50px" src="image/<?php echo $afshan['image'];?       >"></td>
<td><input type="number" name="quantity" min="0" max="3" step="1" value="0">   <input type="submit" name="cart" value="Add to Cart"></td><td></td>
<?php
}
?>
</table>
</div>
</form>
在此处输入代码
品名
产品价格
形象
量
全部的
">

您应该选择“输入代码”而不是“输入图像描述”,这样读者就可以轻松地评估问题(无需导航)。请不要使用图像显示代码…编辑问题正文中的代码。请参阅以了解如何在中编辑代码。我想最好在问题中编写代码示例,而不是在截图中编写代码示例。虽然此代码片段可能是解决方案,但确实有助于提高帖子的质量。请记住,您回答问题是出于真实目的这些人可能不知道您的代码建议的原因。
echo $afshan['price']*$afshan['quantity']