2015-12-30 83 views
-1

我有這個代碼來檢查是否有任何輸入值留空,但由於某種原因頁面不斷吐出一個500錯誤(甚至與錯誤報告,它只會給我一個500錯誤)。PHP空500錯誤

這裏是我的代碼

PHP

function checkInput() { 
echo 'There are one or more errors with your application'; 
if (empty($_POST['MINGNAME'])) { 
    die('Please fill in your in-game name<br>'); 
} elseif (empty($_POST['MSTEAMID'])) { 
    die('Please fill in your Steam-ID (by signing in through Steam)<br>'); 
} elseif (empty($_POST['MAGE'])) { 
    die('Please fill in your age<br>') 
} elseif (empty($_POST['MULX1'])) { 
    die('Please fill out the first ULX command<br>'); 
} elseif (empty($_POST['MULX2'])) { 
    die('Please fill out the second ULX command<br>'); 
} elseif (empty($_POST['MULX3'])) { 
    die('Please fill out the third ULX command<br>'); 
} elseif (empty($_POST['MULX4'])) { 
    die('Please fill out the fourth ULX command<br>'); 
} elseif (empty($_POST['MULX5'])) { 
    die('Please fill out the fifth ULX command<br>'); 
} elseif (empty($_POST['MSIT1'])) { 
    die('Please fill out your first situational<br>'); 
} elseif (empty($_POST['MSIT2'])) { 
    die('Please fill out your second situational<br>'); 
} elseif (empty($_POST['MSIT3'])) { 
    die('Please fill out your third situational<br>'); 
} elseif (empty($_POST['MSIT4'])) { 
    die('Please fill out your fourth situational<br>'); 
} elseif (empty($_POST['MSIT5'])) { 
    die('Please fill out your fifth situational<br>'); 
} else { 
    echo ''; 
} 
} 
checkInput(); 

我不知道這有什麼錯我的代碼。 任何幫助將不勝感激。

+1

看看錯誤日誌。 Ubuntu默認使用'/ var/log/apache2/error.log'。要在頁面上顯示錯誤,除了打開錯誤報告之外,您還需要將'display_errors'設置爲'1'。 –

+0

這真是一個調試問題... – davejal

回答

3

你錯過了在第10行分號:

} elseif (empty($_POST['MAGE'])) { 
    die('Please fill in your age<br>') /* Here */ 
+1

哇,我很笨。非常感謝你指出,大聲笑。 – burger97979

0

沒有分號後:

die('Please fill in your age<br>') 

這將導致PHP解釋器發送一個500 Internal Server Error如果你沒有顯示display_errors

+0

謝謝你! – burger97979

+0

@ burger97979不客氣。 ':)' –