<html>
<head>	
	<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>
<style>
	body {
		background-color: #aac6de;;
	}
	.rounded {
	    margin-top: 3%;
	    margin-left: 25%;
	}
</style>
</head>
<body>
<div class="container" style="padding-top: 2%;">
	
  <div class="jumbotron" style="background-color: #f3f3db;">
  	<img src="./images/6.jpg" class="rounded img-fluid img-thumbnail" alt="Cinque Terre" width="450" height="303"> <br><br>
    <h4 style="margin-left: 25%;">Are you sure you wish to end your email subscription?</h4>  
    
	<div class="form-group" style="padding-right: 40%;height: 30px;margin-left: 25%;"> 
	<form>
		 <input type="hidden" id="oid" name="oid" value ="<?php echo $_REQUEST['oid'];?>" />
			 <label for="email">Email:</label>
		  <input type="email" id="email" name="email" style="height: 40px;font-size: 25px;width:100%;">
		</div><br><br>
		</form>
			
	<div style="text-align: center"> <button style="background-color:#cd6252;color:#fff;border: none;border-radius: 4px;margin-top:16px;font-size: 18px;margin-left: 15px;" VALUE="Unsubscribe" onClick="submt()">Unsubscribe Me</button></div>
   <div id='reslt2' style='color:red'></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>
