【发布时间】:2019-05-27 16:51:02
【问题描述】:
没有数据发送到 mysql。 尝试没有错误消息,我崩溃了终点。
没有数据进入 mysql 服务器
我试图弄清楚它是如何发送的,但完全没有运气。不是代码大师对不起。请帮助修复此错误!
elseif ($inav == "feedbackreport")
{
echo '<div class="alert alert-success" role="alert">';
echo '<h4 class="alert-heading">Feedback report</h4>';
echo '<p>Have some feedback about my site or want contact?</p>';
echo ' <hr>';
echo '<p class="mb-0">Just fill required fields</p>';
echo ' </div>';
{
echo '<form action="?inav=feedbackverify" method="post">';
echo '<p><strong><div style="padding:5px 10px;"><span style="font-size:14px; color:#428FF3;">Describe your feedback</strong><p><p>
<textarea id="feedback" name="feedback" class="form-control" placeholder="Whats the feedback?" rows="3"></textarea>
</div>';
echo '<strong><div style="padding:5px 10px;"><span style="font-size:14px; color:#428FF3;">Your e-mail</span></span></strong><p><p>
<input type="email" name="mail" placeholder="Email" class="form-control">
</div>';
$integer1 = rand(0,10);
$integer2 = rand(0,10);
$sum = $integer1 + $integer2;
echo '<input type="hidden" value="'.$sum.'" name="sum">';
echo '<div class="alert alert-primary" role="alert">
SPAM-protection How much is <span style="color: #808080;"><strong>'.$integer1.' + '.$integer2.'</strong></span> ?
</div>';
echo '<div style="padding:5px 10px;"><span style="font-size:14px; color:#428FF3;">
<input type="number" name="spam" placeholder="Number Answer Only" class="form-control">
</div>';
echo '<div style="padding:5px 10px;"><span style="font-size:14px; color:#428FF3;">
<button type="submit" class="btn btn-secondary btn-sm">Send</button>
</div>';
}
}
elseif ($inav == "feedbackverify")
{
$feedback = mysqli_real_escape_string($conn, $_POST['feedback']);
$mail = mysqli_real_escape_string($conn, $_POST['mail']);
$sum = mysqli_real_escape_string($conn, $_POST['sum']);
$spam = mysqli_real_escape_string($conn, $_POST['spam']);
$mailCheck = mailCheck($mail);
if($mailCheck==TRUE && $sum==$spam)
{
mysqli_query($conn, $query);
$query = "INSERT INTO feedbacks (feedback,mail) VALUES ('".$feedback."','".$mail."')";
echo '<p style="text-align: center;"><span style="color:#008000;"><span style="font-size:18px;"><strong>Thank you for reporting, i will take a look ASAP!</strong></span></span></p> <p style="text-align: center;"><img src="img/smile_big.png" title="Smile more and enjoymy site!" /></p>';
}
else
{
echo '<p><div class="alert alert-danger" role="alert"><span style="color:#FF0000"><strong>Error: Wrong mail format OR wrong spam-protection! Go back and try it again.</strong></span></div>';
echo '<div style="padding:5px 10px;"><INPUT TYPE="button" class="btn btn-secondary btn-sm" VALUE="Go Back" onClick="history.go(-1);"></div>';
}
}
【问题讨论】:
-
代码在回答抱歉,我忘了第一次添加
-
有一个edit link 和一个未回答的删除选项。还要阅读How to get MySQLi error information in different environments、参数绑定等。
-
我知道如何显示错误,这就是修复不适用的地方
-
你需要定义
$query在你执行它。交换两行,所以$query = "[...]";先出现,然后mysqli_query($conn, $query); -
by
mysqli_query($conn, $query);之前$query = "INSERT INTO issues (movieid,issue,mail) VALUES ('".$movieid."','".$issue."','".$mail."')";它仍然不会发送任何东西
标签: php forms mysqli phpmyadmin