<?php
include '../db.php'; // Include your database connection file

if (isset($_POST['category_id'])) {
    $category_id = mysqli_real_escape_string($con, $_POST['category_id']);
    
    // Fetch services for the selected category
    $service_sql = mysqli_query($con, "SELECT * FROM data WHERE data_catagory = 'service' AND data_subCategory = '$category_id' ORDER BY data_sl_no ASC");
    
    // Start generating the service dropdown options
    echo '<option value="">Select Service</option>';
    
    while ($service_row = mysqli_fetch_assoc($service_sql)) {
        echo '<option value="' . $service_row['data_sl_no'] . '">' . $service_row['data_title'] . '</option>';
    }
}
?>