<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['type']) && $_POST['type'] === 'quote') {
    $name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
    $phone = isset($_POST['phone']) ? htmlspecialchars($_POST['phone']) : '';
    $from = isset($_POST['from']) ? htmlspecialchars($_POST['from']) : '';
    $to = isset($_POST['to']) ? htmlspecialchars($_POST['to']) : '';
    $service = isset($_POST['service']) ? htmlspecialchars($_POST['service']) : '';

    $wa_message = "Hello, I would like to request a quote.\n\n"
        . "Name: $name\n"
        . "Phone: $phone\n"
        . "Moving From: $from\n"
        . "Moving To: $to\n"
        . "Service Required: $service\n\n"
        . "Please provide the details and pricing. Thank you!";

    $wa_number = '919100156577'; 

    // Create wa.me link
    $wa_link = "https://wa.me/$wa_number?text=" . urlencode($wa_message);

    // Redirect user to WhatsApp
    header("Location: $wa_link");
    exit;
} 


if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['type']) && $_POST['type'] === 'contact') {
    $name = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
    $email = isset($_POST['email']) ? htmlspecialchars($_POST['email']) : '';
    $message = isset($_POST['message']) ? htmlspecialchars($_POST['message']) : '';

    $wa_message = "Hello, I would like to get in touch with you.\n\n"
        . "Name: $name\n"
        . "Email: $email\n"
        . "Message: $message\n\n"
        . "Please respond at your earliest convenience. Thank you!";

    $wa_number = '919100156577';

    // Create wa.me link
    $wa_link = "https://wa.me/$wa_number?text=" . urlencode($wa_message);

    // Redirect user to WhatsApp
    header("Location: $wa_link");
    exit;
} 


?>