无法添加if语句php

时间:2011-06-29 19:23:33

标签: php

我发布一个textarea值到页面,如果不是我想要抛出错误,该值必须等于“2011”。

我的输入是

<fieldset>
    <span class="subtitle">What year is it?</span>
    <input type="text" name="aspam" id="aspam"/>
</fieldset>

我的php是

if(!isset($_POST['produgg_username']) or !isset($_POST['produgg_password']) or           !isset($_POST['produgg_email']) or $_POST['aspam'] != '2011')
{
    print "Please use all fields";
}elseif(empty($_POST['produgg_username'])){
    print "Please choose a username";
}elseif($_POST['aspam'] != '2011'){
    print "its not 2011!";
}elseif(empty($_POST['produgg_password'])){
    print "Please choose a password";
}elseif(empty($_POST['produgg_email'])){
    print "Please enter an email address";
}elseif(!filter_var($_POST['produgg_email'], FILTER_VALIDATE_EMAIL)) {    
    print "Please enter a valid email address";
}elseif(!preg_match("/^[a-z0-9]+$/i", $_POST['produgg_username'])) {
    print "Please use only characters and numbers for username";
}elseif($usersClass->checkUserExists($_POST['produgg_username'])) {
   print "Username Taken, please choose another";

1 个答案:

答案 0 :(得分:3)

结尾处缺少结束}

   }elseif($usersClass->checkUserExists($_POST['produgg_username'])) {
     print "Username Taken, please choose another";
   }
 ^^^^^ --- add this brace