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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/kanoonisamadhan.in/contact-form.php
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit'])) {
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $subject = $_POST['subject'];
        $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)) {
    $name =htmlspecialchars($_POST['name'],ENT_QUOTES);
    $email =htmlspecialchars($_POST['email'],ENT_QUOTES);
    $subject =htmlspecialchars($_POST['subject'],ENT_QUOTES);
    $phone =htmlspecialchars($_POST['phone'],ENT_QUOTES);
    $message =htmlspecialchars($_POST['message'],ENT_QUOTES);
    
    $sql3="INSERT INTO `tbl_queries`( `name`, `phone`, `email`, `subject`, `message`) VALUES ('$name', '$phone', '$email', '$subject', '$message')";
    $result3 = mysqli_query($db, $sql3) or die("Query unsuccessful");
    
    if($result3){
            echo ("<script>
            window.alert('Succesfully Submitted');
            window.location.href='contact.php';
            </script>");
		
		mysqli_close($db);
     }else{
        echo"Error ";
    }
    
 }
    }
}

?>

<section id="contact_arae_main" class="section_padding">
        <div class="container">
            <div class="row">
                <div class="col-lg-6 offset-lg-3 col-md-12 col-sm-12 col-12">
                    <div class="section_heading">
                        <h3>Contact with us</h3>
                        <h2>Get in
                            <span class="color_big_heading">touch</span> with us &
                            stay connected
                        </h2> 
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6">
                    <div class="contact_area_left">
                        <div class="contact_left_item">
                            <div class="contact_left_icon">
                                <img src="assets/img/icon/map_color.png" alt="icon">
                            </div>
                            <div class="contact_left_text">
                                <h3>Address:</h3>
                                <p><?php echo $data03['address']?></p>
                            </div>
                        </div>
                        <div class="contact_left_item">
                            <div class="contact_left_icon">
                                <img src="assets/img/icon/email-color.png" alt="icon">
                            </div>
                            <div class="contact_left_text">
                                <h3>Email:</h3>
                                <a href="mailto:<?php echo $data03['email']?>"><?php echo $data03['email']?></a>
                                <!-- <a href="mailto:support@domain.com">contact@domain.com</a> -->
                            </div>
                        </div>
                        <div class="contact_left_item">
                            <div class="contact_left_icon">
                                <img src="assets/img/icon/phon-color.png" alt="icon">
                            </div>
                            <div class="contact_left_text">
                                <h3>Phone number:</h3>
                                <a href="tel:<?php echo $data03['phone']?>"><?php echo $data03['phone']?></a>
                                <!-- <a href="tel:+01-123-456-789">+02 345 678 901</a> -->
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="contact_form_Wrapper">
                        <h3>Leave us a message</h3>
                        <form action="<?php $_PHP_SELF ?>" method="POST" >
                            <div class="form-group">
                                <input type="text" class="form-control" name="name" placeholder="Your full 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="form-group">
                                <input type="email" class="form-control" name="email" placeholder="Your email address*" required />
                                <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                                <p class="error">Email field is required.</p>
                                <?php } ?>
                            </div>
                            <div class="form-group">
                                <input type="text" class="form-control" name="phone" placeholder="Your Phone Number*" id="phone_no" 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="form-group">
                                <input type="text" class="form-control" name="subject" placeholder="Subject**" required />
                            </div>
                            <div class="form-group">
                                <textarea class="form-control" rows="6" name="message" placeholder="Message*" required></textarea>
                            </div>
                            <div class="contact_submit_form">
                                <button class="btn btn_theme btn_md" name="submit" type="submit">Send message</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>

MMCT - 2023