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!! )
<form action="contact.php" method="post" name="contactForm" onsubmit="return validateForm()">
<fieldset>
<legend>General Enquiry Form:</legend>
<div>
<label for="genName"><span>*</span>Name:</label>
<input type="text" class="input-wide" name="genName" id="genName"/>
</div>
<div>
<label for="genEmail"><span>*</span>E-mail Address:</label>
<input type="text" class="input-wide" name="genEmail" id="genEmail"/>
</div>
<div>
<label for="genPhone"><span>*</span>Phone Number:</label>
<input type="text" class="input-wide" name="genPhone" id="genPhone"/>
</div>
<div>
<label for="enquiry">Enquiry:</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');
?>