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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/fastelevator.in/../pilingdrillingservices.com/enquiry-form.php
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    if (isset($_POST['submit'])) {
        $firstname = htmlspecialchars($_POST['firstname'],ENT_QUOTES);
        $phone = htmlspecialchars($_POST['phone'],ENT_QUOTES);
        $subjecte = htmlspecialchars($_POST['subject'],ENT_QUOTES);

        if (empty($firstname)) {
            $errors[] = "Name field is required.";
        } elseif (!ctype_alpha($firstname)) {
            $errors[] = "Name can only contain alphabets.";
        }

        if (empty($phone)) {
            $errors[] = "Phone field is required.";
        } elseif (!preg_match('/^\d{10}$/', $phone)) {
            $errors[] = "Phone number should have exactly 10 digits.";
        }
        if (!empty($subject)) {
            $subject = htmlspecialchars($subject); // Sanitize the message input
        }

        if (empty($errors)) {
            
          $sql2="INSERT INTO `tb7_user_issue`(`name`, `phone`,  `message` ) VALUES ('$firstname','$phone','$subjecte')";
          $result2 = mysqli_query($db, $sql2) or die("Query unsuccessful");

       if($result2){
                echo "<script>
                window.alert('Successfully Sent Your Query! We will contact you soon');
                window.location.href = 'http://www.pilingdrillingservices.com/';
                </script>";
            } else {
               echo "Error sending email.";
                }
        }
   }
 }
?>
<style>
    .error{
        color:red;
    }
</style>
<div  class="section section-services section-pad">
    <h3 style="color:#ED4B41" class="text-center ">Enquiry Now</h3>
	    <div class="container box ">
	        <div class="content row">
	        	<!-- Feature Row  -->
				<div class="col-md-6">
				    <form action="<?php $_PHP_SELF?>" method="post">

                        <label for="fname">First Name</label>
                        <input type="text" id="fname" name="firstname" placeholder="Your 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 } ?>

                        <label for="lname">Phone No.</label>
                        <input type="text" id="lname" name="phone" placeholder="Phone No..." minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" 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 } ?>

                        <label for="subject">Subject</label>
                        <textarea id="subject" name="subject" placeholder="Write something.." style="height:100px"></textarea>

                        <input type="submit" name="submit" value="Submit">

                    </form>
				</div>
				<div class="col-md-6">
				    <div class="map">
				    <iframe src="<?php echo $data1['map_link']?>" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade">
				        
				    </iframe>
				    </div>
				</div>
				<!-- Feture Row  #end -->
	        </div>
           
	    </div>
	</div>
	<!-- End Section -->
	

MMCT - 2023