<?php include 'include/header.php';?>
<?php include 'include/navbar.php';?>
<div style="background-image:url('img/about-us.jpg'); background-size: cover; background-repeat: no-repeat;">
<header class="py-5 text-center" style="background-color:rgb(000, 000, 000,0.8);">
  <div class="container">
    <h1 class="text-white section-title">Contact Us</h1>
    <p class="text-white">We’re here to help! Whether you have a question about a visa, need support, or just want to say hello — feel free to reach out.</p>
  </div>
</header>
</div>



<section class="py-5 bg-light">
  <div class="container">

    <div class="row">
      <div class="col-md-6 mb-4">
        <h5 class="fw-bold my-color">Get in Touch</h5>
        <p class="text-muted">Have any questions? Send us a message and our team will respond shortly.</p>

<?php

if (isset($_POST['submit'])) {
    // Verify reCAPTCHA
    $recaptcha_response = $_POST['g-recaptcha-response'];

    $verify = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$recaptcha_secret}&response={$recaptcha_response}");
    $captcha_success = json_decode($verify);

    if (!$captcha_success->success) {
        echo "<p class='p-2 bg-danger text-white text-center rounded'>reCAPTCHA verification failed. Please try again.</p>";
    } else {
        // Escape and sanitize input
        $name    = mysqli_real_escape_string($conn, $_POST['name']);
        $email   = mysqli_real_escape_string($conn, $_POST['email']);
        $number  = mysqli_real_escape_string($conn, $_POST['number']);
        $subject = mysqli_real_escape_string($conn, $_POST['subject']);
        $message = mysqli_real_escape_string($conn, $_POST['message']);

        $sql = "INSERT INTO contact_messages (name, email, phone, subject, message)
                VALUES ('$name', '$email', '$number', '$subject', '$message')";

        if (mysqli_query($conn, $sql)) {
            echo "<p class='p-2 bg-success text-white text-center rounded'>Message sent successfully!</p>";
        } else {
            echo "<p class='p-2 bg-danger text-white text-center rounded'>Error: " . mysqli_error($conn) . "</p>";
        }
    }
}
?>

        <form action="" method="POST">
  <div class="mb-3">
    <label for="name" class="form-label">Full Name</label>
    <input type="text" id="name" name="name" class="form-control" required />
  </div>
  
  <div class="mb-3">
    <label for="email" class="form-label">Email Address</label>
    <input type="email" id="email" name="email" class="form-control" required />
  </div>

  <div class="mb-3">
    <label for="number" class="form-label">Phone Number</label>
    <input type="text" id="number" name="number" class="form-control" required />
  </div>

  <div class="mb-3">
    <label for="subject" class="form-label">Subject</label>
    <input type="text" id="subject" name="subject" class="form-control" required />
  </div>

  <div class="mb-3">
    <label for="message" class="form-label">Your Message</label>
    <textarea id="message" name="message" rows="5" class="form-control" required></textarea>
  </div>

  <!-- Google reCAPTCHA -->
  <div class="mb-3">
    <div class="g-recaptcha" data-sitekey="<?php echo $recaptcha_site;;?>"></div>
  </div>

  <button type="submit" name="submit" class="btn my-btn px-4">Send Message</button>
</form>
      </div>

      <div class="col-md-6">
        <h5 class="fw-bold my-color">Our Contact Info</h5>
        <ul class="list-unstyled mt-3">
          <li class="mb-3">
            <i class="fa fa-map-marker my-color me-2"></i>
            <strong>Address:</strong> <?php echo $info['address']; ?>
          </li>
          <li class="mb-3">
            <i class="fa fa-envelope my-color me-2"></i>
            <strong>Email:</strong>Address: <?php echo $info['email']; ?>
          </li>
          <li class="mb-3">
            <i class="fa fa-phone my-color me-2"></i>
            <strong>Phone:</strong> <?php echo $info['phone']; ?>
          </li>
          <li>
            <i class="fab fa-whatsapp my-color me-2"></i>
            <strong>WhatsApp:</strong> <?php echo $info['whatsapp']; ?>
          </li>
        </ul>
        <div class="mt-4">
          <iframe src="https://www.google.com/maps?q=Dubai,+UAE&output=embed" width="100%" height="250" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
        </div>
      </div>
    </div>
  </div>
</section>








 <?php include 'include/footer.php';?>