我正在开发基于文章(产品)的网站,我希望用户发表评论......
我正在从产品网址中获取产品ID ...并通过插入查询插入注释但不知道为什么会失败...任何帮助??? 我回应查询及其显示数据
<form action="" method="post">
<label style="color: red; font-size: 17px;">Commenter *</label><br>
<input type="text" name="c_name" style="margin-left: 0px; width: 200px; border: 1px groove black;" required="required" placeholder=" Specify your name"/><br>
<br>
<label style="color: red; font-size: 17px">Comment *</label><br>
<textarea style="margin-left: 0px; width: 400px; height: 200px; border: 1px groove black;"required="required" name="c_msg"></textarea><br>
<input style="float: right; margin-right: 280px; width: 80px; background- color: #e99067; color: white; font-family: serif;" type="submit" name="commentit" value="Publish">
include('includes/connect.php');
if(isset($_GET['pro_id'])){
$product_id=$_GET['pro_id'];
if(isset($_POST['commentit'])){
$c_name=$_POST['c_name'];
$c_msg=$_POST['c_msg'];
$add_c="insert into comments
(product_id,comment_name,comment_date,comment_msg)
values ('$c_name',Date(),'$c_msg','$product_id')";
$run_c=mysqli_query($con, $add_c);
if($run_c){
echo "<script>alert('Comment Published
Successfully')</script>";
echo
"<script>window.open('index.php','_self')</script>";
}
else {
echo "nothing done";
}