<?php
require_once "../config/db.php";
require_once "../config/helpers.php";

$customer_id = (int)$_GET['customer_id'];

$result = $conn->query("
SELECT * FROM services 
WHERE customer_id = $customer_id
");

if($result->num_rows > 0){

echo '<table class="table table-bordered">';
echo '<tr><th>Select</th><th>Service</th><th>Amount</th></tr>';

while($row = $result->fetch_assoc()){

echo '<tr>
<td>
<input type="checkbox" 
class="serviceCheck"
name="service_id[]" 
value="'.$row['id'].'"
data-amount="'.$row['amount'].'">
</td>

<td>'.e($row['service_name']).'</td>
<td>₹'.number_format($row['amount'],2).'</td>
</tr>';

}

echo '</table>';

} else {
echo "<span class='text-danger'>No services found</span>";
}