我有一个php表单,用于在没有强制字段的情况下修改用户数据。我想检查用户是否在表单的字段中输入了数据。
我最初的想法是,如果用户单击submit将某些字段保留为空白,则方法POST将在$_POST‘’field‘变量中输入空值。
因此,我检查了$POST‘’field‘变量是否使用'isset’函数设置。不幸的是,就像看起来的那样,POST方法没有在表单中没有指定的变量中输入空值。这使得if(isset($[ POST ))语句成为真,因为POST方法确实为这些变量设置了一些值。
对于如何检查用户是否在字段中输入数据,有什么想法吗?这是我的代码:
<?php
include &
有人能解释一下这个PHP / MySQL为什么不能工作吗?基本上我需要一次从表单中插入大量的行,所以会有多个name字段,多个short,med,long字段等等。我得到了这个错误:
Notice: Undefined variable: Short1 in C:\xampp\htdocs\process.php on line 95
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use ne
我没有在我的代码中找到错误:即使输入为空(对不起,我的英语水平),这段代码也会返回错误代码"message=6“。谢谢你的帮助。
<?php
if (isset($_POST)) {
extract($_POST);
if (isset($_POST['name'])) {
if (isset($_POST['email'])) {
if (!preg_match('#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$#', $_POST['email
我有这样的代码:
<?php
if ( isset($_POST['username']) === true){
echo 'Username is set';
if ( $_POST['username'] == "" ){
echo '<br> Username is empty';
} else {
echo '<br>Username is not empty';
}
}
if ( isset($_
在PHP代码中,当我尝试验证基本登录验证(空字段、数字字段等)时,页面会刷新,所有已经输入的数据都会丢失。我的示例代码:
if(isset($_POST['Submit']))
{
// username and password sent from form
$MailId=$_POST['MailId'];
$Password=$_POST['Password'];
if(empty($_POST['MailId']))
{
$MerrorMessage = "You forgot to