<?php

if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $full_name = $_POST['full_name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $plan = $_POST['plan'];
    $message = $_POST['message'];

    $to = 'hayat@netrosol.com';
    $subject = 'Lead From Uptown-Tower DevelopersAllDubai';
    $body = "Name: $full_name\nEmail: $email\nPhone: $phone\nPlan: $plan\nMessage: $message";
    $headers = "From: $email";

    if(mail($to, $subject, $body, $headers)) {
        // Redirect to home page
        header("Location: thank-you.html");
        exit();
    } else {
        echo "Oops! Something went wrong. Please try again later.";
    }
}
