cancel
Showing results for 
Search instead for 
Did you mean: 

Just discovered web form stopped working

BestPump
Grafter
Posts: 42
Registered: ‎19-09-2007

Just discovered web form stopped working

Hi All,
I've just discovered that my PHP webform has stopped working and I finally understand why the number of website enquiries has dried up!
I've read a few threads on getting a form to work with method="post" but as I have limited PHP knowledge, I'm struggling.
I have a simple PHP form handler on my CCGI space and a couple of forms on my standard webspace that use the form handler.
I was using <form action="http://ccgi.bestpump.plus.com/form_handler.php" method="POST"> and I have no .htaccess file in place.
The PHP form handler is like this:
<?php
// your email address
$youremail = "xxx@xxx.com";
// field validation
if ($name=="" || $company_name=="" || $telephone=="" || $email=="" || $fluid=="" || $viscosity=="" || $temperature=="" || $flowrate=="" || $discharge=="" || $pipework=="" || $connection=="" || $air=="" || $comments=="")
{
print ("<p>Please complete required fields! <a href='#' onclick='history.go(-1);return false;'>Go back</a> to re-enter or <a href='http://www.bestpump.co.uk/company_profile/contact_bestpump.html'>start again</a>.</p>");
}
else {
// email validation
if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email)) {
print ("<p>Your email address does not appear to be valid. Please <a href='#' onclick='history.go(-1);return false;'>go back</a> to re-enter or <a href='http://www.bestpump.co.uk/products/pump_enquiry_form.html'>start again</a>.</p>");
exit;
}
// send email
$headers = "From: \"$name\" <$email>\n";
$subject = "BestPump.co.uk Pump Enquiry";
$message = "The following pump enquiry has come in from the BestPump website. \n \nPlease follow up ASAP! \n \nName: $name \nCompany: $company_name \nTelephone: $telephone \nFax: $fax \nComments: $comments";
mail ("$youremail", "$subject", $message, $headers);
print ("<h2>Thank you for your enquiry</h2><p>Thank you $name, your enquiry has been received and we will respond to you as soon as possible.</p><p>Please return to our home page by <a href='http://www.bestpump.co.uk/index.html'>clicking here</a>.</p>");
}
?>
Could anyone quickly tell me what I need to change to get the form working again and how to do it?
Many thanks,
Jeff
1 REPLY 1
BestPump
Grafter
Posts: 42
Registered: ‎19-09-2007

Re: Just discovered web form stopped working

Just changed the permissions to 700 and it works again.
Months and months of potential enquiries lost for such a small issue - thanks a lot!
Jeff