thankyou.php 6.4 KB
<?php

$utm_source = $_REQUEST['utm_source'] ?? null;
$utm_medium = $_REQUEST['utm_medium'] ?? null;
$utm_campaign = $_REQUEST['utm_campaign'] ?? null;
$utm_content = $_REQUEST['utm_content'] ?? null;
$utm_keyword = $_REQUEST['utm_keyword'] ?? null;
$url_data = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

$name = $_REQUEST['name'] ?? null;
$email = $_REQUEST['email'] ?? null;
$mobile = $_REQUEST['phonenumber'] ?? null;
$formname = $_REQUEST['formname'] ?? null;


// echo "<h2>Form Data:</h2>";
// echo "<p><strong>Name:</strong> " . htmlspecialchars($name) . "</p>";
// echo "<p><strong>Email:</strong> " . htmlspecialchars($email) . "</p>";
// echo "<p><strong>Mobile:</strong> " . htmlspecialchars($mobile) . "</p>";
// echo "<p><strong>Form:</strong> " . htmlspecialchars($formname) . "</p>";


if (!isset($_SESSION['form_submitted'])) {
    // Check if all required fields are filled
    if (!empty($name) && !empty($mobile) && !empty($email)) {
        // Prepare the post fields
        $postFields = "entry.1866747040=" . urlencode($name);
        $postFields .= "&entry.391332552=" . urlencode($mobile);
        $postFields .= "&entry.1319169842=" . urlencode($email);
        $postFields .= "&entry.380527525=" . urlencode($formname);
        $postFields .= "&entry.1619886954=" . urlencode($utmsource);
        $postFields .= "&entry.1888285929=" . urlencode($utmmedium);
        $postFields .= "&entry.731420388=" . urlencode($utmcampaign);
        $postFields .= "&entry.1910662605=" . urlencode($utmcontent);

        // Initialize CURL
        $ch1 = curl_init();
        curl_setopt($ch1, CURLOPT_URL, "https://docs.google.com/forms/d/e/1FAIpQLSeDq16qoqjG3AFO_qnAKats8BPTtl7qLiwQFeM8SICj2NNxVA/formResponse");
        curl_setopt($ch1, CURLOPT_POST, 1);
        curl_setopt($ch1, CURLOPT_POSTFIELDS, $postFields);
        curl_setopt($ch1, CURLOPT_HEADER, 0);
        curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);

        // Execute CURL request
        $result1 = curl_exec($ch1);

        // Check if the submission was successful
        if ($result1 === false) {
            // Generate JavaScript alert for error
            echo "<script>alert('Error: " . curl_error($ch1) . "');</script>";
        } else {
            // Generate JavaScript alert for success
            echo "<script>alert('Data submitted successfully!');</script>";
            // Set session variable to mark the form as submitted
            $_SESSION['form_submitted'] = true;
        }

        // Close CURL
        curl_close($ch1);
    } else {
        // Generate JavaScript alert for missing fields
        echo "<script>alert('Error: Required fields are not filled!');</script>";
    }
} else {
    // Generate JavaScript alert for form already submitted
    echo "<script>alert('Error: Form already submitted!');</script>";
}

?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sahu -Thank You</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
    <link href="style.css" rel="stylesheet" />
</head>

<body>
    <header>
        <nav class="navbar navbar-expand-lg navbar-light">
            <div class="container-fluid">
                <a class="navbar-brand" href="/"><img src="./assets/images/logo.png" alt="logo" /></a>
            </div>
        </nav>
    </header>

    <section class="thankyou text-center h-100 align-content-center" >
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <h1 class="thankyou-heading">Thank You!</h1>
                    <p>Your submission has been received. We will contact you shortly.</p>
                    <a href="/" class="backlink">Go back to Home</a>
                </div>
            </div>
        </div>
    </section>


    <footer>
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="footer-content text-center">
                        <div class="footer-logo justify-content-center gap-5">
                            <img src="./assets/images/sld-logo.webp" alt="SLD Logo" />
                            <img src="./assets/images/footerlogo.webp" alt="Footer Logo" />
                        </div>
                        <div class="footer-qr mt-3 justify-content-center d-flex gap-md-5 gap-2">
                            <img src="./assets/images/qr-1.webp" alt="QR Code 1" />
                            <img src="./assets/images/qr-2.webp" alt="QR Code 2" />
                        </div>
                    </div>
                </div>

                <div class="col-md-12">
                    <div class="rera-details text-center mt-3 text-white">
                        <p>
                            This project is RERA registered.<br />
                            Agent Rera Number : A51900029955 | Project MAHARERA
                            :P51900066547 | P51900066548
                        </p>
                    </div>
                    <div class="mt-2 copy-right text-center text-white">
                        <p>Disclaimer:</p>
                        <p>
                            The content presented on this website is solely for
                            informational purposes and does not constitute a service offer.
                            Prices mentioned here are subject to change without prior
                            notification, and the availability of the listed properties is
                            not assured. Images showcased are illustrative and may not
                            precisely represent the actual properties. Read more
                        </p>
                        <p>
                            COPYRIGHT © 2022. Sahu Land Developers Pvt. Ltd. ALL RIGHTS
                            RESERVED.
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </footer>
</body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
    crossorigin="anonymous"></script>

</html>