我一直在尝试创建一个付款页面,在添加足够的信息后,订单将与购物车中的商品一起进行。由于某种原因,我的代码没有响应并且显示空白屏幕。我对 PHP 比较陌生。有人可以帮我吗?下面是代码:-<?php require_once('../connection.php'); require_once('../product.php'); session_start(); $name = $_POST['name']; $email = $_POST['email']; $address = $_POST['address']; if(isset($_POST['payment-made'])){ if(empty($name) || empty($email) || empty($address)){ echo "<script>alert('Please enter the complete information!'); window.location = 'orders.inc.php';</script>"; } else { if(isset($_SESSION['Uid'])){ if(isset($_SESSION['cart'])){ $product_id = array_column($_SESSION['cart'], 'product_id'); $result = mysqli_query($conn,"SELECT * FROM `products`"); while($row = mysqli_fetch_assoc($result)){ foreach($product_id as $id){ if($row['product_id']==$id){ $ordername = $row['item_name']; $nooforder = 1; $sql1 = "INSERT INTO orders(order_name, no_order, cust_name, del_add) VALUES ('$ordername', '$nooforder', '$name', '$email', '$address');"; $done = mysqli_query($conn, $sql1); if($done){ echo "successful"; } else{ ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); } } } } } } } }?>我怀疑问题出在 $ordername 变量中。谁能澄清造成问题的原因以及如何解决它?
添加回答
举报
0/150
提交
取消