<?php 
include "../session.php";
extract($_REQUEST);

if(isset($_REQUEST['hdnact'])){
	$act = $_REQUEST['hdnact'];
	if($act == "getStatelist"){
		
		$strSelHtml = " <option value=''> Select State </option> ";
		$country_ID = $_REQUEST['countryid'];
		$StrQry="select stateid AS Id,statename AS Name from  ecom_state where 1=1 and countryid='".$country_ID."' order by statename asc";
		$resQry = $db->get_rsltset($StrQry);
						
		if(!empty($resQry)) {
			foreach($resQry as $val) {			
				$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
			}		
		}
		echo $strSelHtml;	
	}	
}
 
function getSelectBox_menulist($db, $SelName, $Attr,$selId=null) {
	if($StrQry ==''){		
		$StrQry="select MenuId AS Id,MenuName AS Name from a_menus where IsActive = '1' order by MenuName asc";
	}	
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$Attr."' id='".$SelName."' name='".$SelName."' ><option value=''>Select</option>";
	
	if(!empty($resQry)) {
		foreach($resQry as $val) {
		$sel='';
			if($selId==$val['Id'])
				$sel=' selected="selected" ';
			$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
		}
	}
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}

?>