<?php session_start();
    if($_SESSION){

?>

<html>
<head>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/all.css">
<style type="text/css">
    /* Made with love by Mutiullah Samim*/



html,body{

background-size: cover;
background-repeat: no-repeat;


font-family: 'Numans', sans-serif;
}</style>
</head>
<body>
 <?php include 'Customer.php';?>
      <br><br><br>
<div class="container" >



<center>

<form method="post">
   <h3  class="text-red" style="text-align: center;color:#8B0000 ;font-family:Monotype Corsiva;font-size: 40px;"><b>Feedback </b></h3>
            <div class="form-group ">
       
        <input type="hidden" id="user_id" name="user_id" class="form-control" value="<?php echo $_SESSION['user_details']['id']?>" placeholder="" required>
       
    </div>
		<div class="form-group row col-lg-10">
		
		<textarea class="form-control" rows="5" name="massage" id="feedback" placeholder="feedback" required></textarea>
		<h5 id="addresscheck"></h5>
		
	</div> <!-- form-group end.// -->
	          <button type="submit" class="btn btn-primary" name="submit" value="submit" style="text-align: center; font-size: 20px">Submit</button>                                
</form>
</article> <!-- card-body end .// -->

</div> <!-- card.// -->
</div> <!-- col.//-->

</div> <!-- row.//-->

</center>
</div> 

<?php //session_start();
if(isset($_POST['submit'])){

     $conn = new mysqli("localhost","root","","event");
    
    $massage = ($_POST['massage']);
    $user_id=   ($_POST['user_id']);
    
    //$Date = test_input($_POST['Date']);
    //$joining  = test_input($_POST['joining']);


    function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  $data = mysql_real_escape_string($data);
  return $data;
}


     
    
    $insert = "insert into feedback (user_id,massage)  
    values ('".$user_id."','".$massage."')";
    
    $confirmation = mysqli_query($conn,$insert);
    
            if($confirmation){
                echo "<script>alert('Your Feedback Sent.')</script>";
            }
        
    else{
        echo " not not";
    
    }
    
}

?>

<!--container end.//-->

<script type="text/javascript">
    $(document).ready(function(){
    	
    		$('addresscheck').hide();
    		
            var address_err =true;
            
         
            $('#address').keyup(function(){
                if(address_check()){
                	$("#address").css("border","2px solid green");
                	$("#addresscheck").html("<p class=text-success>Thank you</p>");
                }else{
                	$("#address").css("border","2px solid red");
                	$("#addresscheck").html("<p class=text-danger>Please Enter your Address</p>");
                }
            });
            function address_check(){
                var address_val =$('#address').val();

                
                  if ((address_val.length == '20')) {
                    
                    address_err =true;
                    return true;
                } else {
                   return false;
                }
            }
            
          
                
           
            $('#ragister').click(function(){
            	var fname_err=true;
            	var lname_err=true;
            	var email_err=true;
            	var address_err=true;
            	var phone_err=true;
            	var male_err=true;
                var user_err =true;
                var pass_err =true;
                var conpass_err =true;
               
                fname_check();
                lname_check();
                email_check();
                address_check();
                phone_check();
                male_check();
                Username_check();
                password_check();
                con_password();
              

                if ((fname_err == true) && (lname_err == true) && (email_err == true) && (address_err == true) && (phone_err == true) && (male_err == true) && (user_err == true) && (pass_err == true) && (conpass_err == true) ) {
                    return true;
                } else {
                    return false;
                }
            });

            

    });


</script>



</body>
</html>
<?php
  }
  else{
    echo "<script>
   alert('You have to  login first...!');
   window.location.href='event2.php';
   </script>";
  }
  
?>