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

if(isset($_POST["parent_childs"]) && !empty($_POST["parent_childs"])){
	 $postdata = $_POST["parent_childs"];
    $query = db_query("SELECT * FROM `tbl_country` WHERE `parent_childs` ='".$postdata."' and country_status = 1 ORDER BY country_name ASC");
    $rowCount = mysqli_num_rows($query);
    if($rowCount > 0){
        echo '<option value="">Select Services</option>';
        while($row = mysqli_fetch_array($query)){ 
        echo '<option value="'.$row['country_id'].'-'.$row['country_url'].'">'.$row['country_name'].'</option>';
        }
    }else{
        echo '<option value=""> Services not available</option>';
    }
}
else if($_POST['state_id']){
$sid = $_POST['state_id'];
//$sid = '51';
$countyqry = db_query("select state_id,county_id,county_name from `tbl_county` where state_id='".$sid."' order by county_name asc  ");	
echo '<option value="0">Select</option>';
while($countyData = mysqli_fetch_array($countyqry)){ 
echo '<option value="'.$countyData['county_id'].'">'.$countyData['county_name'].'</option>';
}
}
else if($_POST['state_id'] && ($_GET['page_id']!='')){
$sid = $_POST['state_id'];
//$sid = '51';
$countyqry = db_query("select county,county_name from `tbl_statecounty` where id='".$_GET['page_id']."' ");	
echo '<option value="0">Select</option>';
while($countyData = mysqli_fetch_array($countyqry)){ 
echo '<option value="'.$countyData['county_id'].'">'.$countyData['county_name'].'</option>';
}
}

/*else if($_POST['county_id']){
$cid = $_POST['county_id'];
//$sid = '51';
$countyeditqry = mysql_query("select county_name from `tbl_statecounty` where county='".$cid."'");	
echo '<option value="0">Select</option>';
while($countyeditData = mysql_fetch_array($countyeditqry)){ 
echo '<option value="'.$countyeditData['county_id'].'">'.$countyeditData['county_name'].'</option>';
}
}*/


?>