<?php
ob_start();
include("include.php");
include("functions.php");
$res='';


if(!empty($_POST['st']) && $_POST['st']=='dis')
{
$sel=executework("select * from haindavasakthi_district where sid='".$_POST['state']."'");
//echo "select * from haindavasakthi_district where sid='".$_POST['st_id']."'order by mandal";
$cnt=@mysqli_num_rows($sel);
while($row=@mysqli_fetch_array($sel))
{
	$res.="~".$row['id']."=".$row['dt_name'];
}
}

if(!empty($_POST['st']) && $_POST['st']=='mandal')
{
	$sel=executework("select * from haindavasakthi_mandal where dtid='".$_POST['dt']."'");
	$cnt=@mysqli_num_rows($sel);
	while($row=@mysqli_fetch_array($sel))
	{
		$res.="~".$row['id']."=".$row['mandal_name'];
	}
}

if(!empty($_POST['st']) && $_POST['st']=='village')
{
	$sel=executework("select * from haindavasakthi_village where mandal_id='".$_POST['mi']."'");
	echo "select * from haindavasakthi_village where mandal_id='".$_POST['mi']."'";
	$cnt=@mysqli_num_rows($sel);
	while($row=@mysqli_fetch_array($sel))
	{
		$res.="~".$row['id']."=".$row['village_name'];
	}
}

if(!empty($_POST['st']) && $_POST['st']=='dharma_sub_cat')
{
	$sel=executework("select * from haindavasakthi_dharma_cat where top_id='".$_POST['sub_id']."'");
	$cnt=@mysqli_num_rows($sel);
	while($row=@mysqli_fetch_array($sel))
	{
		$res.="~".$row['id']."=".$row['category'];
	}
}

if(!empty($_POST['st']) && $_POST['st']=='activity_sub_cat')
{
	$sel=executework("select * from haindavasakthi_catg where top_id='".$_POST['cat_id']."'");
	$cnt=@mysqli_num_rows($sel);
	while($row=@mysqli_fetch_array($sel))
	{
		$res.="~".$row['id']."=".$row['catg_name'];
	}
} 

if(!empty($_POST['st']) && $_POST['st']=='del_img')
{
	echo "update haindavasakthi_activity set ".$_POST['dfield']."='' where id='".$_POST['del_id']."'";
	$upd=executework("update haindavasakthi_activity set ".$_POST['dfield']."='' where id='".$_POST['del_id']."'");
}

//----------- Major Details 

if(!empty($_POST['st']) && $_POST['st']=='major_details')
{
	$sel=executework("select * from lms_major_details where degree_id='".$_POST['degree_id']."' and status=1");
	$cnt=@mysqli_num_rows($sel);
	while($row=@mysqli_fetch_array($sel))
	{
		$res.="~".$row['id']."=".$row['major_name'];
	}
} 


echo $res;
?>