MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.217.224.165
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/yugayurvedaold.com/

[  Home  ][  C0mmand  ][  Upload File  ]

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

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

        if (empty($name)) {
            $errors[] = "Name field is required.";
        } elseif (!preg_match('/^[a-zA-Z ]+$/', $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); 
        }

        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) {
                // Sending email
                $to = "digitalsaleem12@gmail.com";
                // $to ="kartar93singh.04@gmail.com";
                $subject = "New Query Submitted";
                $emailMessage = "A new query has been submitted From Yug Ayurvedic Old:\n\n";
                $emailMessage .= "Name: $name\n";
                $emailMessage .= "Phone: $phone\n";
                $emailMessage .= "Email: $email\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 = 'contact.html';
                </script>";
            } else {
               echo "Error sending email.";
                }
            } else {
              echo "Error";
            }
       }
   }
 }
?>

<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="author" content="">
    <meta name="keywords" content="">
    <meta name="description" content="">
     <?php include "top-links.php";?>
      
    <title><?= $datacontact['site_pages_meta_title'] ?></title>
    <meta name="description" content="<?= $datacontact['site_pages_meta_description'] ?>">

   <style>
       .card p{
           color:#000;
       }
       .card{
           padding:20px;
             box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
                 margin-top: 20px;
       }
   </style>

</head>

<body>
    <div class="ps-page">
        <?php include "header.php";?>
        
      <div class="bread">
            <div class="container"> 
            <div class="title">
                <h1>Contact Us</h1>
                <ul class="breadcrumb">
                  <li><a href="#">Home</a></li>
                  <li>Contact Us</li>
                </ul>
            </div>
        </div>
      </div>
        
        <section class="about-sectoion mt-5 mb-3">
            <div class="container ">
                <div class="row">
                    <div class="col-lg-6">
                        <div class="card">
                            <div class="text-center">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <h3>Phone No.</h3>
                                        <p><a href="tel:<?php echo $data1['phone'];?>"><?php echo $data1['phone'];?></a></p>
                                    </div>
                                    <div class="col-lg-6">
                                        <h3>Allternative Phone No.</h3>
                                        <p><a href="tel:<?php echo $data1['alt_phone'];?>"> <?php echo $data1['alt_phone'];?></a></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="card">
                            <div class="text-center">
                                    <div class="">
                                        <h3>Email:</h3>
                                        <p><a href="mailto:<?php echo $data1['email'];?>"><?php echo $data1['email'];?></a></p>
                                    </div>
                            </div>
                        </div>
                        <div class="card">
                            <div class="text-center">
                                    <div class="">
                                        <h3>Address:</h3>
                                        <p><?php echo $data1['address'];?></p>
                                    </div>
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="col-lg-6">
                        <div class="text-center">
                            <h2>Contact Us</h2>
                        </div>
                         <div class="ps-form--contact">
                        <form  method="post">
                        <h2 class="ps-form__title">Fill up the form if you have any question</h2>
                        <div class="row">
                            <div class="col-12 col-md-4">
                                <div class="ps-form__group">
                                    <input class="form-control ps-form__input" type="text" name="name" placeholder="Name*">
                                </div>
                            </div>
                            <div class="col-12 col-md-4">
                                <div class="ps-form__group">
                                    <input class="form-control ps-form__input" type="email" name="email" placeholder="E-mail*">
                                </div>
                            </div>
                            <div class="col-12 col-md-4">
                                <div class="ps-form__group">
                                    <input class="form-control ps-form__input" type="tel" name="phone" placeholder="Phone*">
                                </div>
                            </div>
                            <div class="col-12">
                                <div class="ps-form__group">
                                    <textarea class="form-control ps-form__textarea" rows="5" name="message" placeholder="Message*"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="ps-form__submit">
                            <input type="submit" name="submit" class="ps-btn ps-btn--warning">
                            <!--<button class="ps-btn ps-btn--warning">Send message</button>-->
                        </div>
                        </form>
                    </div>
                    </div>
                </div>
            </div>
        </section>
        
        
        <div class="container mt-3 mb-2">
            <iframe src="<?php echo $data1['map_link'];?>" width="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
        </div>

        <?php include "footer.php";?>
    </div>
   
</body>


</html>

MMCT - 2023