gpt4 book ai didi

php - Mysqli 查询不插入第一个值

转载 作者:太空宇宙 更新时间:2023-11-03 10:43:08 26 4
gpt4 key购买 nike

<分区>

我花了几个小时试图找出我的问题,但没有运气:/我正在运行这个查询:

if($_POST) {
$ask_name = mysqli_real_escape_string($connect, $_POST['ask_name']);
$ask_email = mysqli_real_escape_string($connect, $_POST['ask_email']);
$ask_text = mysqli_real_escape_string($connect, $_POST['ask_text']);
$ask_category = mysqli_real_escape_string($connect, $_GET['categ']);
$ask_time = date("d-F-Y");

if($ask_name = "" || $ask_email == "" || $ask_text == "" || $ask_category == "") {
$msg = '<span class="fa fa-exclamation-triangle fa-lg"></span> Fill Out All Inputs Please';
}

else {
$insert_post = mysqli_query($connect, "INSERT INTO forum_posts (name, email, text, category, time) VALUES ('$ask_name', '$ask_email', '$ask_text', '$ask_category', '$ask_time')");
header('Location: forum.php?categ=' .$ask_category);
exit();
}
}

这是我的 php 文件中的表单

<!--Insert Post-->
<form id="ask-question" method="post" name="ask_question" action="">
<label for="ask-name">Your Name</label><br>
<input type="text" name="ask_name" id="ask-name"><br>
<label for="ask-email">Your E-Mail (Won't be displayed)</label><br>
<input type="email" name="ask_email" id="ask-email"><br>
<label for="ask-text">Your Question</label><br>
<textarea name="ask_text" id="ask-text"></textarea><br>
<input type="submit" name="post_submit" value="Ask Now" id="post-submit">
<?php if(isset($msg)) { echo('<p>' .$msg. '</p>'); } ?>
</form>

问题是查询没有插入“name”值。所有其他值都已成功插入到我的 mysql 数据库中,但“名称”值除外。

有什么想法吗?非常感谢!

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com