<?php
include 'includes/connect.php';

if(isset($_POST['category_id'])){

    $category_id = intval($_POST['category_id']);

    $query = "SELECT id, label_name 
              FROM lifeline_configuration 
              WHERE category_id = '$category_id'
              ORDER BY label_name ASC";

    $result = mysqli_query($conn, $query);

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

    if(mysqli_num_rows($result) > 0){
        while($row = mysqli_fetch_assoc($result)){
            echo '<option value="'.$row['id'].'">'.$row['label_name'].'</option>';
        }
    } else {
        echo '<option value="">No Variety Found</option>';
    }
}
?>