rand(1, 10), 'num2' => rand(1, 10), 'answer' => $_SESSION['captcha']['num1'] + $_SESSION['captcha']['num2'] ]; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = trim($_POST['name']); $email = trim($_POST['email']); $phone = trim($_POST['phone']); $subject = trim($_POST['subject']); $message = trim($_POST['message']); $captcha_input = isset($_POST['captcha']) ? (int)$_POST['captcha'] : 0; if ($captcha_input !== $_SESSION['captcha']['answer']) { echo "
Incorrect CAPTCHA answer. Please try again.
"; } else { $to = "info@warmseal-roofing.co.uk"; $website_name = "Warmseal Roofing contact"; $from_email = "noreply@" . $_SERVER['HTTP_HOST']; $headers = "From: " . $website_name . " <" . $from_email . ">" . "\r\n" . "Reply-To: " . $name . " <" . $email . ">" . "\r\n" . "X-Mailer: PHP/" . phpversion(); $body = "You have received a new message from Warmseal Roofing Contact form:\n\n" . "Name: " . $name . "\n" . "Email: " . $email . "\n"; if (!empty($phone)) { $body .= "Phone Number: " . $phone . "\n"; } $body .= "Subject: " . $subject . "\n\n" . "Message:\n" . $message; if (mail($to, 'New Message from ' . $website_name, $body, $headers)) { echo "
Thank you for contacting us. We will get back to you shortly.
"; } else { echo "
There was an error sending your message. Please try again.
"; } } // Generate a new CAPTCHA for the next submission AFTER processing the form $_SESSION['captcha'] = [ 'num1' => rand(1, 10), 'num2' => rand(1, 10), 'answer' => $_SESSION['captcha']['num1'] + $_SESSION['captcha']['num2'] ]; } ?>

Get in touch

Contact us

Mobile: 07379893869

Phone: 01254492373

Address:Unit 9, Pheonix Works, Willows Lane, Accrington, BB5 0RT

Covering a 50 mile radius of Accrington, including Blackburn, Burnley, Nelson, Colne, Clitheroe, and surrounding areas.