<?php
require_once("../include/config.php");
require_once("../include/startup.php");

$testclass    			= 	new AllTables();
if(!empty($_POST["country_id"])) {
	$statename = $_POST["statename"];
	$query ="SELECT * FROM mststate WHERE countryid = '" . $_POST["country_id"] . "'";
	
		  $results	         = $testclass-> getInfo("",$query);
	
?>
	<option value="">Select State</option>
<?php
	foreach($results as $state) {
			if(strtoupper($statename)==strtoupper($state[$i]['StateName']))
				{
?>
	<option value="<?php echo $state["StateId"].'-'.$state["StateName"]; ?>" selected=""><?php echo $state["StateName"]; ?></option>
<?php
	}
	else 
	{
?>
	<option value="<?php echo $state["StateId"].'-'.$state["StateName"]; ?>"><?php echo $state["StateName"]; ?></option>
<?php
}
}
}
?>