Php 为什么isset函数没有';你不更新我的数据库吗?

Php 为什么isset函数没有';你不更新我的数据库吗?,php,isset,Php,Isset,我不明白为什么isset函数在这里不起作用: include 'db.php'; if(isset($_POST['Submit'])) { $name = $_POST['title']; $text = $_POST['text']; $category = $_POST['category']; $insert = mysqli_query($con, "INSERT INTO `items`( `title`, `text`,

我不明白为什么isset函数在这里不起作用:

include 'db.php';
if(isset($_POST['Submit'])) {

$name = $_POST['title'];
    $text = $_POST['text'];
    $category = $_POST['category'];

    $insert = mysqli_query($con,
    "INSERT INTO `items`(
    `title`, 
    `text`, 
    `category`
    ) 
    VALUES (
    '$name', 
    '$text', 
    '$category')"
    );
    if (!$insert) {
        echo mysqli_error($con);
    } else {
        echo "Inserted!";
    }
}




<form method="post">
<input type="text" name="title" placeholder="Enter the title..">
<input type="text" name="text" placeholder="Enter the text..">
<input type="text" name="category" placeholder="Enter the category..">
<input type="submit" value="Submit">
</form>
包括“db.php”;
如果(isset($_POST['Submit'])){
$name=$_POST['title'];
$text=$_POST['text'];
$category=$_POST['category'];
$insert=mysqli\u查询($con,
“在`项目'中插入`(
`标题`,
`文本`,
`类别`
) 
价值观(
“$name”,
“$text”,
“$category”)
);
如果(!$insert){
echo mysqli_错误($con);
}否则{
回声“插入!”;
}
}
数据库未更新。
没有它,我的代码就可以了,但它不是我想要的。

您的输入提交没有name属性

<input type="submit" value="Submit" name="Submit">

您需要使用name attribute,name attribute的文本应该与isset匹配($\u POST['submit'])


添加
名称
属性以提交按钮。看到这个了吗