MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.147.36.106
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/ltbuildcon.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/ltbuildcon.com/contact.php
<?php
include_once('admin/config.php');

if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit'])) {
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $message = $_POST['message'];

        if (empty($name)) {
            $errors[] = "Name field is required.";
        } elseif (!ctype_alpha($name)) {
            $errors[] = "Name can only contain alphabets.";
        }

        if (empty($email)) {
            $errors[] = "Email field is required.";
        }

        if (empty($phone)) {
            $errors[] = "Phone field is required.";
        } elseif (!preg_match('/^\d{10}$/', $phone)) {
            $errors[] = "Phone number should have exactly 10 digits.";
        }
        if (!empty($message)) {
            $message = htmlspecialchars($message); // Sanitize the message input
        }

        if (empty($errors)) {
            $query = "INSERT INTO `tbl_queries` (`name`, `phone`, `email`, `message`) VALUES (?, ?, ?, ?)";
            $stmt = mysqli_prepare($db, $query);
            mysqli_stmt_bind_param($stmt, "ssss", $name, $phone, $email, $message);
            $result = mysqli_stmt_execute($stmt);
            mysqli_stmt_close($stmt);

            if ($result) {
                echo "<script>
                    window.alert('Successfully Sent! We will contact you soon');
                    window.location.href = '$wspath' + 'contact.html';
                </script>";
            } else {
                echo "Error";
            }
        }
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Contact - L T Buildcon</title>
    <?php include 'top-link.php';?>
</head>
<body>
<div id="page_wrapper">
<?php include 'header.php';?>
 <!--============== Page Banner Start ==============-->
        <div style="background-image: url(https://img.freepik.com/free-photo/modern-architecture-shapes-futuristic-cityscape-reflecting-travel-innovation-generative-ai_188544-15491.jpg?w=1060&t=st=1689238114~exp=1689238714~hmac=c57ef68…);background-size: cover;" class="page-banner-simple bg-secondary py-40">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                       
                    </div>
                </div>
            </div>
        </div>
        <!--============== Page Banner End ==============-->
        
         <!--============== Page title Start ==============-->
        <div class="full-row py-5">
            <div class="container">
                <div class="row">
                    <div class="col">
                        <h1 class="text-secondary">Contact</h1>
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb mb-0 bg-transparent p-0">
                                <li class="breadcrumb-item"><a href="<?php echo $wspath?>">Home</a></li>
                                <li class=" active text-primary" aria-current="page"> - Contact</li>
                            </ol>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
        <!--============== Page title End ==============-->

        <!--============== Contact form Start ==============-->
        <div class="full-row pt-0">
            <div class="container">
                <div class="row">
                    <div class="col-md-5 order-md-2">
                        <h4 class="down-line mb-4">Get In Touch</h4>
                       
                        <div class="mb-3">
                            <ul>
                                <li class="mb-3">
                                    <h6 class="mb-0">Office Address :</h6> <?php echo $datac["address"]; ?>
                                </li>
                                <li class="mb-3">
                                    <h6>Contact Number :</h6>  <a href="tel:<?php echo $datac["phone"]; ?>"><?php echo $datac["phone"]; ?></a>
                                    <br> 
                                    <a href="tel:<?php echo $datac["alt_phone"]; ?>"> <?php echo $datac["alt_phone"]; ?></a>
                                </li>
                                <li class="mb-3">
                                    <h6>Email Address :</h6>
                                    <a href="mailto:<?php echo $datac["email"]; ?>"><?php echo $datac["email"]; ?></a>
                                </li>
                            </ul>
                        </div>
                       
                    </div>
                    <style>
                        .error{
                            color:red;
                        }
                    </style>
                    <div class="col-md-7 order-md-1">
                        <h4 class="down-line mb-4">Send Message</h4>
                        <div class="form-simple">
                            <form method="post" action="<?php $_PHP_SELF?>">
                                <div class="row">
                                    <div class="col-md-6 mb-20">
                                        <label class="mb-2">Full Name:</label>
                                        <input type="text" class="form-control bg-white" name="name" required>
                                        <?php if (isset($errors) && in_array("Name field is required.", $errors)) { ?>
                                            <p class="error">Name field is required.</p>
                                        <?php } elseif (isset($errors) && in_array("Name can only contain alphabets.", $errors)) { ?>
                                            <p class="error">Name can only contain alphabets.</p>
                                        <?php } ?>
                                    </div>
                                    <div class="col-md-6 mb-20">
                                        <label class="mb-2">Your Email:</label>
                                        <input type="email" class="form-control bg-white" name="email" required>
                                        <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                                            <p class="error">Email field is required.</p>
                                        <?php } ?>
                                    </div>
                                    <div class="col-md-12 mb-20">
                                        <label class="mb-2">Phone:</label>
                                        <input type="text" class="form-control bg-white" name="phone" id="phone_no" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" required>
                                        <?php if (isset($errors) && in_array("Phone field is required.", $errors)) { ?>
                                            <p class="error">Phone field is required.</p>
                                        <?php } elseif (isset($errors) && in_array("Phone number should have exactly 10 digits.", $errors)) { ?>
                                            <p class="error">Phone number should have exactly 10 digits.</p>
                                        <?php } ?>
                                    </div>
                                    <div class="col-md-12 mb-20">
                                        <label class="mb-2">Message:</label>
                                        <textarea class="form-control bg-white" name="message" rows="8" required></textarea>
                                    </div>
                                    <div class="col-md-12">
                                        <button class="btn btn-primary" name="submit" type="submit">Send Message</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--============== Contact form End ==============-->
<?php include 'footer.php';?>
</div>
</body>
</html>

MMCT - 2023