<?php 
require('../config/dbcon.php');//connect
if(isset($_POST['search'])){
    $search = $_POST['search'];
	$query = "SELECT state_name,st_code FROM statecode_mst WHERE Lower(state_name) LIKE Lower('%".$search."%') or Lower(st_code) LIKE Lower('%".$search."%') order by state_name 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;
?>