<?php
// Include the database connection file
include('config.php');
 
if (isset($_GET['project']) && !empty($_GET['project'])) {
 
 // Fetch state name base on country id
 $query = "SELECT CATEGORY FROM master_process WHERE PROJECT = ".$_POST['project'];
 echo $query;
 $result = $con->query($query);
 
 if ($result->num_rows > 0) {
 echo '<option value="">Select category</option>';
 while ($row = $result->fetch_assoc()) {
 echo '<option value="'.$row['CATEGORY'].'">'.$row['CATEGORY'].'</option>';
 }
 } else {
 echo '<option value="">category not available</option>';
 }
} elseif(isset($_POST['category']) && !empty($_POST['category'])) {
 
 // Fetch city name base on state id
 $query = "SELECT STAGE FROM master_process WHERE CATEGORY = ".$_POST['category'];
 $result = $con->query($query);
 
 if ($result->num_rows > 0) {
 echo '<option value="">Select stage</option>';
 while ($row = $result->fetch_assoc()) {
 echo '<option value="'.$row['STAGE'].'">'.$row['STAGE'].'</option>';
 }
 } else {
 echo '<option value="">Stage not available</option>';
 }
}
?>