<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $to = "leonel.construction.services@email.com"; // 🔹 replace with your business email
    $subject = "Inquiry from Leonel Construction services Website";

    $name = htmlspecialchars($_POST['name']);
    $email = htmlspecialchars($_POST['email']);
    $message = htmlspecialchars($_POST['message']);

    $headers = "From: $email\r\n";
    $headers .= "Reply-To: $email\r\n";

    $body = "leonel-construction-services.neocities.org:\n\n";
    $body .= "Name: $name\n";
    $body .= "Email: $email\n\n";
    $body .= "Message:\n$message\n";

    if (mail($to, $subject, $body, $headers)) {
        // ✅ Redirect to thank you page
        header("Location: thankyou.html");
        exit();
    
?>
