2013-05-03 98 views
0

我做了一堆if語句打印出來,當用戶通過php中的註冊碼。代碼如下:無法獲得註冊邏輯正確

<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發送數據之後,我添加了一個數組並添加了一個值。然後我說如果它不是空的(如果完成,應填寫)打印聲明。

它對我有意義,但爲什麼它不工作?

非常感謝!

+0

取消對最後} – 2013-05-03 05:32:55

+0

我們將需要看到更多的代碼...你'其他if'不是封閉的,哪裏'$ errors'從何而來,等...什麼@ CaptOtis說。 – Ben 2013-05-03 05:33:32

+0

這是爲了上面的評論。它不與任何東西 – RightLeftRight12 2013-05-03 05:33:44

回答

1

如果我沒有弄錯你需要使用if而不是else if

if(empty($regDone) === false){ 
    echo "Check Email to activate account!"; 
} 
+0

工作正常!非常感謝! – RightLeftRight12 2013-05-03 05:42:00