csrtechnew.ohctech.in/get_sub_center.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());
}
$ohc = mysqli_real_escape_string($conn, $_POST['ohc']);
$query_activities = "SELECT id, sub_center_name FROM sub_center WHERE ohc_type_id = '$ohc'";
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 Sub Center</option>";
while ($row = $result->fetch_assoc()) {
$activity_options .= "<option value='" . htmlspecialchars($row['id']) . "'>" . htmlspecialchars($row['sub_center_name']) . "</option>";
}
echo $activity_options;
} else {
echo "<option value=''>Invalid request</option>";
}
?>