當使用PHP嘗試使用post
小表單時,出現HTTP錯誤405。代碼如下。我該如何解決這個問題?如何解決HTTP錯誤405
<div class="quiz-section">
<form action="quiz.php" method="post">
#################
<input type="submit" class="btn blue" name="submitQuiz" value="Submit" />
</form>
</div>
<?php
if (isset($_POST['submitQuiz'])) {
if(isset($_POST['quest1'])&&isset($_POST['quest2'])&&isset($_POST['quest3']))
{
if(($_POST['guestName']!="")&&($_POST['guestEmail']!="")){
$to = 'a######@yahoo.com';
$subject = 'Quiz Answer Submission';
$message = "Submited by: ".$_POST['guestName']." From email: ".$_POST['guestEmail']." Answers are: ".$_POST['quest1'].", ".$_POST['quest2'].", ".$_POST['quest3'];
$headers = 'From: j#####@live.in' . "\r\n" .
'Reply-To: '.$_POST["guestEmail"] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo "Thanks for your submission. We successfully received your answers. Stay tuned.";
//header("Location: index.html#quiz-questions?status=Success");
}
else{
echo "Please go back and answer all quiz questions";
}
}
else{
echo "Please fill all the fields and answer to all questions";
//header("Location: index.html#quiz-questions?status=Error");
}
}
?>
的錯誤信息是:
The page cannot be displayed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
Please try the following:
Contact the Web site administrator if you believe that this request should be allowed.
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
HTTP Error 405 - The HTTP verb used to access this page is not allowed.
Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 405.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Setting Application Mappings, Securing Your Site with Web Site Permissions, and About Custom Error Messages.
[405 HTTP錯誤 - PHP POST]可能的重複(http://stackoverflow.com/questions/3677751/405-http-error-php-post) – TML 2014-09-29 00:30:16
在你的'&& isset ....中添加空格....'聲明,也檢查文件權限 – Ahmad 2014-09-29 00:31:03
@TML,它沒有一個正確的答案! – user1012181 2014-09-29 01:21:23