<?php 
// Include the database config file 
   include_once('config/db.php');  include_once('config/check.php'); 


 
 if(!empty($_POST["country_id"]))
{ 
    // Fetch state data based on the specific country ".$_POST['country_id']."
    
     
    $stmt = $conn->query(" SELECT * FROM sys_sub_module WHERE  module =  ".$_POST['country_id']." and active=1    ");

            echo '<option value="">  Select submodule </option>'; 

            while ($row = $stmt->fetch())
            {
                  echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';  
            }

}
  elseif(!empty($_POST["state_id"]))
    { 
    // Fetch city data based on the specific state 
       $stmt = $conn->query(" SELECT * FROM sys_submodule_child WHERE  submodule = ".$_POST['state_id']."  and active=1     ");
       
       echo '<option value="">  Select submodule child  </option>'; 
       echo '<option value="0">  NO child  </option>'; 
       while ($row = $stmt->fetch())
       {
             echo '<option value="'.$row['id'].'">'.$row['name'].'</option>';  
       }
    } 
?>