An invalid method (HTTP verb) is being used

Hi all,

A website I built approx 2 years ago, has had its 2 “forms” on the website just stop randomly working, and an error is now thrown, this being:

“The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.”

Looking into this on the several forums, I`m finding that a few people are saying the method=post should be changed too method=get, either way neither are having an effect on the form being submitted, and for this for to just randomly stop working as it was working 100% fine up until I was notified, has completely baffled me…

The code for my contact form for anyone to view is as follows: ( Any help with looking at this would be massively appreciated!! :slight_smile: )


<form action="contact.php" method="post" name="contactForm" onsubmit="return validateForm()">

			<fieldset>
				<legend>General Enquiry Form&#58;</legend>
					<div>
						<label for="genName"><span>*</span>Name&#58;</label>
						<input type="text" class="input-wide" name="genName" id="genName"/>
					</div>
							<div>
								<label for="genEmail"><span>*</span>E&#45;mail Address&#58;</label>
								<input type="text" class="input-wide" name="genEmail" id="genEmail"/>
							</div>

									<div>
										<label for="genPhone"><span>*</span>Phone Number&#58;</label>
										<input type="text" class="input-wide" name="genPhone" id="genPhone"/>
									</div>
											<div>
												<label for="enquiry">Enquiry&#58;</label>
												<textarea  class="input-wide input-textareaContact" name="enquiry" rows="5" cols="30"></textarea>
											</div>
				
			
													<div id="general">
														<input class="submitContact" name="submit" type="submit" value="Submit"/>
														<input class="resetContact" name="reset" type="reset" value="Reset"/>
													</div><!--submitReset ends-->			
			
			</fieldset>
		</form>

And my php code is:


<?php

error_reporting(E_ALL|E_STRICT);

ini_set('display_errors', false);

/* Set e-mail recipient */

$mailto  = "sales@mydomain.co.uk";
$subject = "New General enquiry off Website" ;

/**
 * Quick validate func
 */
function validate($var)
{
    return addslashes(trim($var));
}

$genName = validate($_POST['genName']);
$genPhone = validate($_POST['genPhone']);
$genEmail = validate($_POST['genEmail']);
$enquiry = validate($_POST['enquiry']);
$thanksurl = "http://mydomain.co.uk/contactThankyou.html" ;
$errorurl = "http://mydomain.co.uk/contactError.html" ;

/*Redirects the user to the error page if JS is disabled and the form is submitted*/
if($genName == '' || $genEmail == '' || $genPhone == '') {
    header('Location: contactError.html');

exit;
}

/* Prepare the message for the e-mail */
$message = "You have a new General enquiry from:

Company name: $genName
Client phone number: $genPhone
Clients e-mail: $genEmail
Clients message: $enquiry
End of message
";

// Headers for email
$headers = 'From: '.$email . "\\r\
" .
    'Reply-To: '.$email . "\\r\
" .
    'X-Mailer: PHP/' . phpversion();

/* Sends the message using mail() function */
mail($mailto, $subject, $message, $headers);

/* Redirects the visitor to the thanks page */
header('Location: contactThankyou.html');


?>

Seems to me the problem is actually with the webserver, IIS. Have you looked at this: http://forums.asp.net/t/1650010.aspx/1 ?

And since this is a form that triggers a server side action that must not be cache-able (sending an email), it must be a POST, not GET, so don’t change that.

Hi Rémon,

Co-incidently I actually came across that link on my hunt whilst trying to locate some troubleshooting documents earlier on today.

Because I have never come across this type of “http” error thrown before, is it something that effectively the hosting company will have to resolve for me, as this is really outside of my remit ?

I think that it’s up to them to solve this, as I don’t think they’ll give you access to the admin tools mentioned. I’d shoot them an e-mail, or phone them, with the exact error message, and the URL of the post I linked to earlier.