<?php
 $_SESSION['error_msg'] = "";
 use Phppot\Captcha;
    require_once "model/Captcha.php";
    $captcha = new Captcha();
require_once("header.php");
require_once("menu.php");
?>
<!-- Breadcrumbs Start -->
        <div class="rs-breadcrumbs sec-spacer">
            <div class="overlay"></div>
            <div class="container">
                <div class="row">
                    <div class="col-md-12 text-center">
                        <div class="breadcrumbs-inner">
                            <h1 class="page-title">Contact Us</h1>
                            <ul>
                                <li>
                                    <a class="active" href="https://ethicsprosperity.com">Home</a>
                                </li>
                                <li>Contact Us</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Breadcrumbs End -->

            <!-- contact area start -->
            <div class="contact-area sec-spacer">
                <div class="container">
                    <div class="title-header text-center">
                                        <h2 class="why-t">Our Presence</h2>
                                        
                                    </div><br><br>
                    <div class="contact-info-wrap">
                
                    
                    
                    <!--new-->
					
					
					<?php
                  $ex = $obj->view_contact_info();
                  while($row=mysqli_fetch_array($ex))
                  {
                  ?>
                     <div class="row">
                         <div class="col-md-6 col-sm">
                               <div class="contact-box">
                              <div class="location-box surat">
                                    <ul class="location-inner" style="margin:0">
                                        <li class="icon"><i class="fas fa-map-marker-alt"></i></li>
                                        <li>
                                            
                                            <?php echo $row['office_address'];?>
                                        </li>
                                    </ul>
                                    
                                    <ul class="location-inner" style="margin-bottom:30px">
                                        <li class="icon"><i class="far fa-envelope-open"></i></li>
                                        <li>
                                            <h4>Email</h4>
                                            <a href="mailto:<?php echo $row['office_email'];?>"><?php echo $row['office_email'];?></a> 
                                        </li>
                                    </ul>
                                    
                                    <ul class="location-inner" style="margin-bottom:30px">
                                        <li class="icon"><i class="far fa-envelope-open"></i></li>
                                        <li>
                                            <h4>Phone</h4>
                                            <a href="tel:<?php echo $row['office_phone'];?>"><?php echo $row['office_phone'];?></a> 
                                        </li>
                                    </ul>
                                    
                                    
                              </div>
							  </div>
							      </div>
							   <div class="col-md-6 col-sm">
                              <div class="surat-map">
                                  <?php echo $row['office_map'];?>
								  </div>
                              </div>
                 </div>
				 
				 
				 
				 
				 
				 <div class="space"></div>
				 
				 <?php } ?>
                          
                     
                    
                    <div class="custom-row-2 contactforsec">
                        
                        <div class="col-lg-12 col-md-12" style="padding:0">
                            <div class="contact-form">
                                <div class="contact-title text-center">
                                   <h3 class="cont">Get In Touch With Us</h3>
                                   <p class="text-center">Let us know what you have in mind, and we’ll get back to you in an instant!  </p>
                                  </div>
                                <form class="contact-form-style" method="post" action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>" autocomplete="off">
                                   <input type="hidden" id="refreshed" value="no">
                                     <div class="row">
                                        <div class="col-lg-6">
                                            <input name="name" placeholder="Name*" type="text" value="<?php echo $_POST['name'];?>" autocomplete="off" required=""/>
                                        </div>
                                        <div class="col-lg-6">
                                            <input name="email" placeholder="Email*" type="email" value="<?php echo $_POST['email'];?>" autocomplete="off" required=""/>
                                        </div>
                                        <div class="col-lg-6">
                                            <input name="subject" placeholder="Subject*"  type="text" value="<?php echo $_POST['subject'];?>" autocomplete="off" required=""/>
                                        </div>
                                        <div class="col-lg-6">
                                             <input name="phone" type="text"  placeholder="Phone Number*" value="<?php echo $_POST['phone'];?>" autocomplete="off"  pattern="\d{10}" title="10 digit Mobile No." maxlength="10" onkeypress="return isNumber(event)" required="required">
                                        </div>
                                        
                                        <div class="col-lg-12">
                                            <textarea name="message"  placeholder="Your Message"  autocomplete="off"><?php echo $_POST['message'];?></textarea>
                                        </div>
                                        
                                        <div class="col-lg-12">
                                         <input name="captcha_code" type="text" class="form-control captcha-input" autocomplete="off" placeholder="Captcha Code*" required="">
                                       </div>
                                       
                                        <div class="col-lg-12">
                                           <center><button class="submit readon" name="submit" type="submit">SEND</button> <center>
                                        </div>
                                         
                                    </div>
                                </form>
                                <?php
                                if(isset($_POST['submit'])){
                                  $email['name'] = $_POST['name'];
                                  $email['phone'] = $_POST['phone'];
                                  $email['email']= $_POST['email'];
                                  $email['subject']= $_POST['subject'];
                                  $email['message'] = $_POST['message'];
                                  $userCaptcha = filter_var($_POST["captcha_code"], FILTER_SANITIZE_STRING);
                                  $isValidCaptcha = $captcha->validateCaptcha($userCaptcha);
                                  if ($isValidCaptcha) {
                                  $contact= $obj->contact_email($email);
                                  echo "<b>".$contact."</b>";
                                  header("Location:thank-you.php");
                              }
                              else
                               {
                                  echo $_SESSION['error_msg'] = "<b>Incorrect Captcha Code</b>";
                               }
                                }
                                ?>
                               
                            </div>
                        </div>
                       
                    </div><br>

                   
                </div>
            </div>
            <!-- contact area end -->

</div>
 
<?php
require_once("footer.php");
?>

