<?php 
include("include/connection.php");
session_start();
 
if(isset($_POST['submit']))
{
    // 
    
   $userid=$_SESSION['frontuserid'];
   $type= mysqli_real_escape_string($con,$_POST['type']);
   $mobile= mysqli_real_escape_string($con,$_POST['mobile']);
   $out_id=mysqli_real_escape_string($con,$_POST['out_id']);
   $description=mysqli_real_escape_string($con,$_POST['description']);
 
  $sql = "INSERT INTO tbl_complaints (userid,type,out_id,mobile,description,status)
                                 VALUES ('$userid','$type','$out_id','$mobile', '$description',0)";
                                 
    // print_r($sql);exit;
   if(mysqli_query($con, $sql)){  

    echo "<script>
alert('sucessfully');
window.location.href='complaints_and_suggestions';
</script>";  

    }else{  

    echo "<script>
alert('failed');
window.location.href='add_complaints';
</script>";  

    }  
}
?>