0

我正在将表单提交到页面并检查是否提交按钮值 InsertMe isset 但没有执行里面的代码

<?php 
if (isset($_POST['InsertMe'])){

//code to execute
echo "Test";

}
?>

和插入按钮看起来像这样

<input style="float:right;" name="InsertMe" id="InsertMe" type="submit" class="rectangular-button" value="Add User" />
4

3 回答 3

1
if (!isset($_POST['InsertMe']) || empty($_POST['InsertMe'])) {

// error message here

} else {

// What you want to do if not empty and is set.

}

此代码将检查变量是否已设置以及是否为空。

“||” 是要检查或的 PHP 运算符。所以在这种情况下,它正在检查它是否设置或为空。

于 2013-08-09T13:39:49.403 回答
1

确保您已将表单标签设置为发布。

<form method="post">
于 2013-08-09T13:49:24.303 回答
0

您正在选择 Id 我认为我们应该在 isset() 中使用名称标签参数

于 2019-01-28T13:13:44.540 回答