<?php
include_once('../../includes/config.php');

if (!empty($_GET['catid'])) {
    $catid = intval($_GET['catid']);
    $query = mysqli_query($con, "SELECT * FROM subcategory WHERE categoryid='$catid'");

    echo '<option value="">Select Subcategory</option>';
    while ($row = mysqli_fetch_array($query)) {
        echo '<option value="' . $row['id'] . '">' . htmlentities($row['subcategory']) . '</option>';
    }
}
?>