<?php include ("header.php"); ?>
<!--==================================================-->
<!-- Start breadcumb-area -->
<!--==================================================-->
<div class="breadcumb-area d-flex align-items-center">
	<div class="container">
		<div class="row">
			<div class="col-lg-12">
				<div class="breacumb-content">
					<div class="breadcumb-title">
						<h1>contact us</h1>
					</div>
					<div class="breadcumb-content-text">
					<a href="index.php"> home <i class="fas fa-angle-right"></i><span>contact us</span></a>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--==================================================-->
<!-- Start product-section -->
<!--==================================================-->

<!--==================================================-->
<!-- Start call-do-action -->
<!--==================================================-->

<!--==================================================-->
<!-- Start Company Info-area -->
<!--==================================================-->
<div class="company-info-section">
	<div class="container">
		<div class="row company">
		
			<!--<div class="col-lg-8 col-md-8">-->
				<div class="col-lg-12">
				<div class="contac-title">
					<div class="main-titles">
						<h3>Get a free Quote</h3>
						<p>Contact us today for a free consultation and quote for your garden project.</p>
					</div>
				</div>
				<!--<form action="https://formspree.io/f/myyleorq" method="POST" id="dreamit-form">-->
				<form action="https://formspree.io/f/myyleorq" method="POST" id="myForm" enctype="multipart/form-data">
				    <div id="check1"></div>
					<div class="row">
						<div class="col-lg-6 col-md-6">
							<div class="form_box">
								<input type="text"  id="name" name="name"  placeholder="Name">
							</div>
						</div>
						<div class="col-lg-6 col-md-6">
							<div class="form_box">
								<input type="text"  id="email" name="email"  placeholder="Email">
							</div>
						</div>
						<div class="col-lg-6 col-md-6">
							<div class="form_box">
								<input type="text" id="phone" name="phone" placeholder="Phone">
							</div>
						</div>
						<div class="col-lg-6 col-md-6">
							<div class="form_box">
								<input type="text" id="subject" name="subject" placeholder="Subject">
							</div>
						</div>
						<div class="col-lg-12 col-md-12">
							<div class="form_box">
								<textarea type="text" name="message" id="message" cols="30" rows="10" placeholder="Your Message"></textarea>
							</div>
							<div class="form-button">
							     <button type="submit" id="btn_submit"  theme-btn  class="sigma_btn-custom" >Send Message</button>
								<!--<button type="submit">Send quote</button>-->
							</div>
						</div>
					</div>
				</form>
				<div id="status"></div>
			</div>
		</div>
	</div>
</div>

<!--form---------->

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
      
        $('#myForm').submit(function(e){
            
            e.preventDefault();
            var name = $('#name').val();
            var email = $('#email').val();
            var phone = $('#phone').val();
            var subject = $('#subject').val();
            var message = $('#message').val();
            var error = false;
            var flg=1;
           // alert(name);alert(email);
        //   alert(message);
           console.log(message);
             var name_regex="^[a-zA-Z\\s]*$";
            var email_regex =/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.in)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi;
            var phone_regex=/\d{10}/;
     
       if(!name.match(name_regex) || name == "")
        {
          $('#check1').html('** Please Enter your Name **').css( "color", "red");
          $("#name").focus();
          var error = true;
          return false;
        }
        if (!email.match(email_regex)|| email == "") 
        {
          $('#check1').html('** Please Enter Your Email Id **').css( "color", "red");
          $("#email").focus();
          var error = true;
          return false;
        }
        if (phone == "") 
        {
        
        
          $('#check1').html('** Please Enter Your Phone **').css( "color", "red");
          $("#phone").focus();
          var error = true;
          return false;
        }
    
     if (subject == "") 
        {
          $('#check1').html('** Please Enter Your Subject **').css( "color", "red");
          $("#subject").focus();
          var error = true;
          return false;
        } 
        
        
         if (message == "") 
        {
          $('#check1').html('** Please Enter Your Message **').css( "color", "red");
          $("#message").focus();
          var error = true;
          return false;
        } 
        
        
        if(error!=true)
            {
                $('#btn_submit').attr({'disabled' : 'true', 'value' : 'Sending...' });  
               var form = $('#myForm')[0];
                var formData = new FormData(form);
                $.ajax({
                    url: "contact-valid.php", 
                    type: "POST",             
                    data: formData,
                    contentType: false,       
                    cache: false,             
                    processData:false, 
                    success: function(data) {
                    
                       
                        if(data=='sent')
                        {
                            $('#btn_submit').removeAttr('disabled').attr('value', 'Sent')
                            $('#check1').html('** Thank You For Contacting Us,We Will Contact You Soon.. **').css( "color", "green");
                           /* url = "thankyou.php";
                                $( location ).attr("href", url);*/
                         
                            $("#myForm").get(0).reset();
                            
                        }
                        else
                        {
                            $('#btn_submit').removeAttr('disabled').attr('value', 'Retry');
                            $('#check1').html(data).css("color","red");
                        }
                    }
                });
                return false;
            }
            else
            {
                alert("error");
            }
        });
    });
</script> 
       
  



       <?php include ("footer.php"); ?>