<?php
include 'db.php';

$type = $_POST['type'] ?? '';

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

$res = mysqli_query($conn,"
SELECT * FROM stone_materials 
WHERE type='$type' 
AND status='active'
");

while($row = mysqli_fetch_assoc($res)){
    echo "<option value='{$row['id']}'>{$row['name']}</option>";
}