<?php $sql = "SELECT * FROM contact_master ";
   $myquery=$conn->query($sql);
   $mydara= $myquery->fetchAll()  ;
   
   $rows_found = $myquery->rowCount();
   foreach ($mydara as $key ) {
    $banner_image= $key['banner_image'];
    $hubspot= $key['email_hubspot'];
    
   }
   
   ?>
<!--Get The Latest & Best Coupon/Offer Alerts Begin-->
<section class="my-4">
   <div class="container">
      <div class="subscribe">
         <div class="row align-items-center">
            <div class="col-md-6">
               <h4 class="fw-bold">Get The Latest & Best Coupon/Offer Alerts</h4>
               <p class="py-4">Unlimited Subscriptions Across Worldwide & Counting! Subscribe to have latest coupon, promo code lists delivered directly to your email.</p>
               <div class="mb-3">
                           <label class="fw-bold form-label">Email Address:<span class="text-danger ps-1">*</span></label>
                            <input type="email" class="form-control   validate[required,custom[email]] text-input" name="emailid" maxlength="45" placeholder="Type Email" data-gtm-form-interact-field-id="0" id="user_subscriber">
                            <button type="submit" id="subscribe" class="btn btn-secondary m-3">Submit</button>
                        </div>
                       
                          <div id="success" class="text-success visually-hidden">

                          </div>
                       
            </div>
            <div class="col-md-6">
               <img src="images/web-images/home/subscribe-img.png" alt="subscribe" title="subscribe" class="img-fluid float-end">
            </div>
         </div>
      </div>
   </div>
</section>
<script src="./js/jquery-3.4.1.min.js"></script>
<script>
   $(document).on("click","#subscribe" , function(e){          
								 
				
				
				var names =$("#user_subscriber").val();
             console.log(names);
				$.ajax({
               type : "POST",
                  dataType : "json",
                  url:"user_subscriber.php",
                  data:{names:names},
                  success: function(data){
                  //console.log(data)
						 if(data!= "")
                 
						{
							$('#success').html("Thank you for subscribing");
						 	$('#success').removeClass('visually-hidden');
                      $('#user_subscriber').val("");
                  //    $('#unsuccess').addClass('d-none');
						setTimeout(function(){  $('#success').addClass('visually-hidden'); },4000); //reload a page after 5 seconds
						}
						
					  },
					  error: function(res) {
						  console.log('there was a problem checking the fields');
					  }
				}); 
			});
</script>
<!--Get The Latest & Best Coupon/Offer Alerts End-->