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

$sql=mysql_query("select * from tbl_state where country_id='".$_POST['country_id']."'");
if(!sql)
{
	echo mysql_query();
}
else{
	if($res=mysql_num_rows($sql)>0)
	{
		$data='';
		while($res=mysql_fetch_array($sql))
		{
			if($_POST['edit_state_id']!='' && $_POST['edit_state_id']==$res['state_id'])
			{
				$data.= "<option value='".$res['state_id']."' selected='selected'>".$res['state_name']."</option>";
			}
			else{
				$data.="<option value='".$res['state_id']."'>".$res['state_name']."</option>";
			}
		}
	}else{
		$data.="<option value=''>--Not Available--</option>";
	}
	echo $data;
}
?>