<?php 
require('../config/dbcon.php');//connect
if(isset($_POST['search'])){
    $search = $_POST['search'];
	$query = "SELECT * FROM statecode_mst WHERE st_code LIKE '%".$search."%' or Lower(state_name) LIKE '%".$search."%' order by st_code limit 10";
    $result = mysqli_query($connect,$query);    
    while($row = mysqli_fetch_array($result) ){		
        $response[] = array("label"=>$row['state_name'],"value"=>$row['st_code']);		
    }
    echo json_encode($response);
}
exit;
?>