Contact form

if ($_SERVER[“REQUEST_METHOD”] == “POST”) {

function clean($data) {
return trim(stripslashes($data));
}

$name = clean($_POST[‘name’] ?? ”);
$mobile = clean($_POST[‘mobile’] ?? ”);
$email = clean($_POST[’email’] ?? ”);
$message = clean($_POST[‘msg’] ?? ”);
$reference = clean($_POST[‘reference’] ?? ”);

// FIXED RECEIVER EMAIL
$clientMailID = “ai.kunaltayade@gmail.com”;

// Auto redirect to thank you page
$redirectURL = “thankyou.html”;

// Extra fields
$loginID = “career-form”;
$orderID = time();

// Validation
if (empty($name) || empty($mobile) || empty($email)) {
die(“Please fill all required fields.”);
}

if (!preg_match(‘/^[0-9]{10}$/’, $mobile)) {
die(“Invalid mobile number.”);
}

// Email Subject
$subject = “New Contact Form Submission – Order ID: $orderID”;

// Email Body
$body = ”
New Contact Form Enquiry

Name: $name
Mobile: $mobile
Email / State / City: $email
Message: $message
Reference: $reference

LoginID: $loginID
OrderID: $orderID
“;

// Headers
$headers = “MIME-Version: 1.0\r\n”;
$headers .= “Content-type: text/html; charset=UTF-8\r\n”;
$headers .= “From: noreply@droneworld.co.in\r\n”;
$headers .= “Reply-To: $email\r\n”;

// Send Email
if (mail($clientMailID, $subject, $body, $headers)) {
header(“Location: $redirectURL”);
exit;
} else {
echo “Error: Mail could not be sent.”;
}
}
?>

 

Career Opportunities Contact Form