MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.144.89.42
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/arcsol.in/assets/../../furnitureofindia.in/../aanuwoolenenterprises.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/arcsol.in/assets/../../furnitureofindia.in/../aanuwoolenenterprises.com/enquiry.php
<?php
include_once('admin/config.php');

    $art_no = $_POST['art_no'];
        $sizes = $_POST['sizes'];
        $length = $_POST['length'];
        $width = $_POST['width'];
        $mrp = $_POST['mrp'];


if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['c_submit'])) {
        
        
        $cust_name = $_POST['cust_name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $qty = $_POST['qty'];
        $address = $_POST['address'];

        if (empty($cust_name)) {
            $errors[] = "Name field is required.";
        } elseif (!ctype_alpha($cust_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_orders` (`product_name`, `qty`, `size`, `mrp`, `length`, `width`,`cust_name`, `phone`, `email`, `address`) VALUES (?, ?, ? ,?, ?, ?, ? ,? ,? ,?)";
            $stmt = mysqli_prepare($db, $query);
            mysqli_stmt_bind_param($stmt, "ssssssssss", $art_no, $qty, $sizes, $mrp, $length, $width, $cust_name, $phone, $email, $address);
            $result = mysqli_stmt_execute($stmt);
            mysqli_stmt_close($stmt);

            if ($result) {
            // Sending email
            $to = "digitalsaleem12@gmail.com";
            $subject = "New Query Submitted";
            $emailMessage = "A new query has been submitted:\n\n";
            $emailMessage .= "Product Details\n\n";
            $emailMessage .= "Art No: $art_no\n";
            $emailMessage .= "Length: $length\n";
            $emailMessage .= "width: $width\n";
            $emailMessage .= "Sizes: $sizes\n";
            $emailMessage .= "MRP: $mrp\n";
            $emailMessage .= "Quantity: $qty\n\n";
            $emailMessage .= "Customer Details\n\n";
            $emailMessage .= "Name: $cust_name\n";
            $emailMessage .= "Phone: $phone\n";
            $emailMessage .= "Email: $email\n";
            $emailMessage .= "Address: $address\n";
            // $emailMessage .= "Message: $message\n";
            
            $headers = "From: $email";
            
            if (mail($to, $subject, $emailMessage, $headers)) {
            echo "<script>
            window.alert('Successfully Sent! We will contact you soon');
            window.location.href = '$wspath'+'index.php';
            </script>";
            } else {
            echo "Error sending email.";
            }
        }
        
        }
    }
}

?>
<!DOCTYPE html>
<html lang="zxx">
<head>
    <meta charset="UTF-8">
    <meta name="description" content="Fashi Template">
    <meta name="keywords" content="Fashi, unica, creative, html">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Annu Woolen Enterprise</title>
    <?php include 'top-link.php';?>
    
</head>

<body>
<?php include 'header.php';?>
<div class="breacrumb-section">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="breadcrumb-text">
                        <a href="index.php"><i class="fa fa-home"></i> Home</a>
                        <span>Enquiry</span>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>

    <section class="enquiry">
        <div class="container">
            <div class="row">
                <div style="margin: auto;" class="col-md-5">
                    <div class="enquiry-box">
                        <h4 class="text-center">Enquiry Form</h4>
                        <form action="<?php $_PHP_SELF?>" method="POST">
                        <input name="art_no" value="<?php echo $art_no?>" hidden>
                        <input name="sizes" value="<?php echo $sizes?>" hidden>
                        <input name="length" value="<?php echo $length?>" hidden>
                        <input name="width" value="<?php echo $width?>" hidden>
                        <input name="mrp" value="<?php echo $mrp?>" hidden>
                     <div class="mb-3 mt-3">
                        <label for="cust_name" class="form-label">Name:</label>
                        <input type="text" class="form-control" name="cust_name">
                        <?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><br>
                      <div class="mb-3 mt-3">
                        <label for="contact" class="form-label">Conatct Number:</label>
                        <input type="phone" class="form-control" name="phone">
                        <?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><br>
                      <div class="mb-3 mt-3">
                        <label for="email" class="form-label">Email:</label>
                        <input type="email" class="form-control" name="email">
                        <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                            <p class="error">Email field is required.</p>
                        <?php } ?>
                      </div><br>
                      <div class="mb-3 mt-3">
                        <label for="email" class="form-label">Quantity:</label>
                        <input type="number" class="form-control" name="qty">
                      </div><br>
                      <div class="mb-3 mt-3">
                        <label for="email" class="form-label">Address:</label>
                        <textarea type="number" class="form-control" name="address"> </textarea>
                      </div>
                      
                  
                  <button style="margin: auto;display: block;" type="submit" name="c_submit" class="btn btn-primary">Submit</button>
                </form>
                    </div>
                </div>
            </div>
        </div>
    </section>

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

MMCT - 2023