csrtechnew.ohctech.in/get_shg_beneficiry.php
2025-04-14 13:28:09 +05:30

30 lines
1.0 KiB
PHP

<?php
// Include the database connection file
include 'includes/config/config.php'; // Adjust the path as necessary
// Check if the connection is successful
if (!$conn) {
error_log("Database connection failed");
die("Connection failed: " . mysqli_connect_error());
}
$shg = mysqli_real_escape_string($conn, $_POST['shg']);
$query_activities = "SELECT id, patient_name FROM patient_master WHERE sub_center = '$shg'";
error_log("Check_ohc_id : ".$query_activities);
if ($result = $conn->query($query_activities)) {
$activity_options = "<option value=''>Select Sub Center Name</option>";
$activity_options .= "<option value='all'>Select For All Beneficiry</option>";
while ($row = $result->fetch_assoc()) {
$activity_options .= "<option value='" . htmlspecialchars($row['id']) . "'>" . htmlspecialchars($row['patient_name']) . "</option>";
}
echo $activity_options;
} else {
echo "<option value=''>Invalid request</option>";
}
?>