<?php 
ob_start();
session_start();
include("../inc/config.php");


if(isset($_POST['type']) && $_POST['type']=='pincode_info'){
    $id=$_POST['pincode'];
    $statement = $pdo->prepare("SELECT * FROM pincode where id='".$id."' limit 1");
    $statement->execute();
    $_data = $statement->fetchAll(PDO::FETCH_ASSOC);
    $totalData = $statement->rowCount();
    $conditions="1=1";
    
    
    if($totalData){
        
        $data='';
     $destin='';   
        foreach($_data as $d){
            $data="<tr id='pic_".$d['id']."'>
				    <td class='delete' style='text-align:center;' onclick='remove(".$d['id'].")' ><i class='fa fa-trash'></i></td>
				    <td><b style='font-weight:800;'> ".$d['pin_code']."</b></td>
				    <td><i class='fa fa-map-marker'></i> <span class='no_of_box'>".$d['city']."</span></td>
				    <td><i class='fa fa-map-marker'></i> <span class='no_of_box'>".$d['state']."</span></td>
				    <td>".$d['service']."</span></td>
				    
				</tr>";
					$destin=$d['consignee_city'];
        }

        $response['destination']=$destin;
        $response['error']=false;
        $response['data']=$data;
        $response['message']="shipment details fetched";
    }else{
        $response['error']=true;
        $response['message']="no data found";
    }
    print_r(json_encode($response));
}


?>