<?php include_once("../includes/main.inc.php");


if(isset($_POST["services_id"]) && !empty($_POST["services_id"])){
	$postdata = explode('_',$_POST["services_id"]);
    $query = mysql_query("SELECT * FROM tbl_country WHERE parent_childs= ".$postdata[0]." AND country_status = 1 ORDER BY country_name ASC");
    $rowCount = mysql_num_rows($query);
    if($rowCount > 0){
        echo '<option value="">Select Sub Services</option>';
        while($row = mysql_fetch_array($query)){ 
		
            echo '<option value="'.$row['country_id'].'_'.$row['country_name'].'">'.$row['country_name'].'</option>';
        }
    }else{
        echo '<option value=""> State not available</option>';
    }
}

if(isset($_POST["state_id"]) && !empty($_POST["state_id"])){
	$postdata = explode('_',$_POST["state_id"]);
    $query = mysql_query("SELECT * FROM tbl_county WHERE state_id = ".$postdata[0]." AND county_status = 1 ORDER BY county_name ASC");
    $rowCount = mysql_num_rows($query);
    if($rowCount > 0){
        echo '<option value="">Select State</option>';
        while($row = mysql_fetch_array($query)){ 
            echo '<option value="'.$row['county_id'].'_'.$row['county_name'].'">'.$row['county_name'].'</option>';
        }
    }else{
        echo '<option value=""> State not available</option>';
    }
}
 
if(isset($_POST["county_id"]) && !empty($_POST["county_id"])){
	$postdata = explode('_',$_POST["county_id"]);
    $query = mysql_query("SELECT * FROM tbl_city WHERE county_id = ".$postdata[0]." AND city_status = 1 ORDER BY city_name ASC");
    $rowCount = mysql_num_rows($query);
    if($rowCount > 0){
        echo '<option value="">Select city</option>';
        while($row = mysql_fetch_array($query)){ 
            echo '<option value="'.$row['city_id'].'_'.$row['city_name'].'" >'.$row['city_name'].'</option>';
        }
    }else{
        echo '<option value="">City not available</option>';
    }
}
 
if(isset($_POST["city_id"]) && !empty($_POST["city_id"])){
	$postdata = explode('_',$_POST["city_id"]);
    $query = mysql_query("SELECT * FROM tbl_block WHERE city_id = ".$postdata[0]." AND block_status = 1 ORDER BY block_name ASC");
    $rowCount = mysql_num_rows($query);
    if($rowCount > 0){
        echo '<option value="">Select Sub city</option>';
        while($row = mysql_fetch_array($query)){ 
            echo '<option value="'.$row['block_id'].'_'.$row['block_name'].'" >'.$row['block_name'].'</option>';
        }
    }else{
        echo '<option value="">Sub City not available</option>';
    }
} 
 
?>