<!DOCTYPE html>
<html lang="en">
<head>
  <title>Unsubscribe</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

  <style>
    body {
      background-image: url("./images/3.jpg");
      background-repeat: no-repeat;
    }
  </style>
<div class="container" >
  <h2 style="color: red; padding-top: 2%;">Unsubscribe</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Click</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
        <form>
             <input type='hidden' id='oid' name='oid' value ="<?php echo $_REQUEST['oid'];?>" />        		
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Enter your email address to unsubscribe from this list.</h4>
        </div>
        <div class="modal-body">
        <label for="usr">Email:</label>
        <input type="text" class="form-control" id="email" name="email" style="height: 47px;font-size: 25px; text-align: center;">
        </div>
        <div class="modal-footer">
        </form>
         <div style="text-align: center"> <button style="padding:10px 16px;background-color:#cd6252;color:#fff;border: none;border-radius: 4px;margin-top:16px;font-size: 18px;margin-left: 15px;width:70%" VALUE="Unsubscribe" onClick="submt()">Unsubscribe Me</button></div>
   <div id='reslt2' style='color:red'></div>  
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>


      <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script  type="text/javascript" >


function submt()
{
	
var email = $('#email').val();
var oid= $('#oid').val();
var emailReg = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
if(email =='')
{
$('#reslt2').text('Please enter email!');
}
else if (!emailReg.test(email))
{
$('#reslt2').text('Please insert valid Email');
}
else
{
$.ajax({
type: "POST",
url: "unsubsuccess.php",
data: "mail="+email+"&oid="+oid,
success: function(data)
{
$('#reslt2').html("<b>Unsusbcribed Successfully!!");
}
});
return false;
}

}
</script>
