<?php
include_once("include/dbconnect.php");
if(!empty($_POST["coutrycode"])) 
{
//$query =mysqli_query($con,"SELECT * FROM state WHERE countryid = '" . $_POST["coutrycode"] . "'");
$query=mysqli_query($conn, "select * from mec_sub_category where mec_catid=".$_POST['coutrycode']." and mec_status=1 order by orderset"); 
?>
 <option value="0">Select Sub category</option>
<?php
while($row=mysqli_fetch_array($query))  
{
?>
<option value="<?php echo $row["mec_subid"]; ?>"><?php echo $row["mec_sub_name"]; ?></option>
<?php
}
}
?>