<?php
$arr= array();
include("connect_db.php");
$name=$_POST['name'];
$jilla_id= $_POST['jilla_id'];
$taluka_id= $_POST['taluka_id'];
$gram_id= $_POST['gram_id'];
$gram_name= $_POST['gram_name'];
$name2= $_POST['name2'];
$survey_name= $_POST['survey_name'];
$mbl= $_POST['mbl'];
$adhar= $_POST['adhar'];
$old_tax_no= $_POST['old_tax_no'];
$s_s_no= $_POST['s_s_no'];
$s_s_m= $_POST['s_s_m'];
$group_no= $_POST['group_no'];
$plot_no= $_POST['plot_no'];
$total_sqft= $_POST['total_sqft'];
$north_south= $_POST['north_south'];
$east_west= $_POST['east_west'];
$details= $_POST['details'];
$north= $_POST['north'];
$south= $_POST['south'];
$east= $_POST['east'];
$west= $_POST['west'];
$gate= $_POST['gate'];
$wife_mbl= $_POST['wife_mbl'];
$wife_adhar= $_POST['wife_adhar'];
$img= $_POST['img'];
$mapimg= $_POST['mapimg'];
$nal= $_POST['nal'];
$washroom= $_POST['washroom'];
$tax_number= $_POST['tax_number'];
$img_upload= $_POST['img_upload'];
$map_upload= $_POST['map_upload'];
$by = $_POST['by'];
$sr = $_POST['sr'];
$created_at= date('d-m-y h:i:s');
$updated_at= date('d-m-y h:i:s');
$img_filename="$mbl".rand().".jpg";
file_put_contents("images/".$img_filename,base64_decode($img_upload));
$map_filename="$mbl".rand().".jpg";
file_put_contents("images/".$map_filename,base64_decode($map_upload));
$sql_insert= "INSERT INTO survey_infos(name, jilla_id, taluka_id, gram_id, anu_karmank, gram_name, name2, survey_name, mbl, adhar, old_tax_no, s_s_no, s_s_m, group_no, plot_no, total_sqft, north_south, east_west, details, north, south, east, west, gate, wife_mbl, wife_adhar, img, mapimg, nal, washroom, tax_number, status,added_by, created_at, updated_at) VALUES ('$name',$jilla_id,$taluka_id,$gram_id, '$sr','$gram_name','$name2','$survey_name','$mbl','$adhar','$old_tax_no','$s_s_no','$s_s_m',$group_no,$plot_no,$total_sqft,$north_south,$east_west,'$details','$north','$south','$east','$west','$gate','$wife_mbl','$wife_adhar','$img_filename','$map_filename','$nal','$washroom',$tax_number,'active','$by','$created_at','$updated_at')";
/*echo $sql_insert;
exit();*/
$res= mysqli_query($con,$sql_insert);
if($res){
    $data['status']="success";
}
else{
    $data['status']="fail";
    $data['message']=mysqli_error($con);
}
array_push($arr,$data);
echo json_encode($arr);
?>