I'm getting a HTTP Error 405 when trying to post
a small form using PHP. Codes are given below. How can I solve this one?
<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 Error message is:
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.