他是谁,有谁知道如何解决这个问题? php没有看到所选数据,并在按下submitButton
后给出错误信息是空的我的代码:
<?php
session_start();
require_once '../connections/dbc.php';
$product_name = mysqli_real_escape_string($conn, $_POST['product_name']);
if (isset($_POST['submitButton'])) {
if (!empty($_POST['product_name'])) {
$sql=" INSERT INTO `order`(`product_name`) VALUES('$product_name');";
$result = mysqli_query($conn, $sql);
if (!$result) {
echo "ERROR INSERTING THE ORDER IN THE DATABASE";
}
} else{
echo "EMPTY";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>TEST SITE</title>
</head>
<body>
<form method="POST">
<select>
<option disabled="disabled" selected="selected" style="text-align: center;">--SELECT--</option>
<?php
require_once '../connections/dbc.php';
$query = "SELECT `product_name` FROM `product`";
$response = @mysqli_query($conn, $query);
if (!$response) {
echo "NO RESPONES";
} else{
while($row = mysqli_fetch_array($response)){
echo '<option name="product_name" value="'.$row['product_name'].'" >'.$row['product_name'].'</option>';
}
}
?>
</select>
<button name="submitButton" id="submitButton"></button>
</form>
</body>
</html>