我收到以下錯誤,當我運行我的PHP腳本:爲什麼我得到這個分析錯誤?
Parse error: syntax error, unexpected '!' in C:\xampp\htdocs\sandbox\get-started.php on line 43.
這是第43行:
!isset($_POST['budget']) || empty($_POST['budget'])
代碼:
if(
!isset($_POST['name']) || empty($_POST['name']) ||
!isset($_POST['email']) || empty($_POST['email']) ||
!isset($_POST['company']) || empty($_POST['company'])
!isset($_POST['budget']) || empty($_POST['budget'])
!isset($_POST['message']) || empty($_POST['message'])
){
}else{
$body = "From: " . $_POST['name'] . "\n E-Mail: " . $_POST['email'] . "\n Company: " . $_POST['company'] . "\n Monthly Budget: " . $_POST['budget'] . "\n Message: " . $_POST['message'] "";
if (mail ($to, $subject, $body, $from)) {
echo '<p class="success">Awesome, your message was sent!</p>';
} else {
echo '<p class="error">Uh oh, something went wrong, try again.</p>';
}
}
如何解決這個問題?
它解決了這個問題,但現在我得到;; T_CONSTANT_ENCAPSED_STRING – user3232801
@ user3232801檢查我更新的答案,應該解決該錯誤。 – jboneca
真棒,它的工作!謝謝!我看到你說過要重新考慮我這樣做的方式,你會介意給我看正確的方法嗎? – user3232801