0

当用户通过 php.ini 中的注册码时,我做了一堆 if else 语句来打印出来。代码如下:

<div class="lower-body">
    <div class="left-lower">Create an account</div>
    <div id="account-first">
    <?php 
    /*if(@$_POST['action'] == 'register' && empty($errors) === true){
        echo 'You\'ve been registered successfully!' . "\n"; 
        echo 'Please check email and activate account!'; 
    }else {*/

    if(empty($_POST) === false && empty($totalError) === true ){
        $register_data = array(
            'firstname' => $_POST['firstname'],
            'lastname'  => $_POST['lastname'],
            'username'  => $_POST['username'],
            'password'  => $_POST['password'],
            'email'     => $_POST['email'],
            'areacode'  => $_POST['areacode']
            );

        register_user($register_data);
        $regDone[] = 'VALUE';
        echo 
        //header('Location: register.php?sucess');
        //exit();
    } else if(empty($errors) === false){
        echo output_errors($errors);
        } else if(empty($regDone) === false){
            echo "Check Email to activate account!";
        }
    //}
?>

最后它说您必须检查您的电子邮件以进行激活。在将数据提供给mysql之后,我添加了一个数组并为其添加了一个值。然后我说如果它不为空(如果完成则应填写)打印该语句。

这对我来说很有意义,但为什么它不起作用?

非常感谢!

4

1 回答 1

1

If I'm not getting you wrong you need to use if instead else if.

if(empty($regDone) === false){
    echo "Check Email to activate account!";
}
于 2013-05-03T05:33:49.523 回答