检查多个文本框是否为空PHP如果没有则执行php

时间:2013-11-29 18:50:18

标签: if-statement textbox

<?
  if ($_POST['username'] == NULL){ //if nothing is entered or only a zero is entered
    echo "Missing a field.";
  }else{
    //rest of code
  }

这不会处理我有3个文本框:用户名,密码,电子邮件

2 个答案:

答案 0 :(得分:1)

尝试以下PHP代码

<?
if ($_POST['username'] == NULL || 
    $_POST['password'] == NULL || 
    $_POST['email'] == NULL)
{ //if nothing is entered or only a zero is entered
echo "Missing a field.";
}else{
//rest of code
}

答案 1 :(得分:0)

if(empty($_POST['memberfullname'])){ 
    header("Location:srgbusinesspartnersmsg.php");
 } else {
    $insert= $con->command($ins);
    header("Location:srgvalidatepartners.php");
} 

这对我有用。如果它为空,则重定向对话框表单,然后执行作业,这是一个要执行的插入语句

加入Missionsoft编程学院(mtscertification.com)