<?php
$servername = "localhost";
$username = "venmobdc_Auto_DataBase_User";
$password = "hB_nf_W-^SIh";
$dbname = "venmobdc_Auto_Database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$selectedTable = $_POST['selectedTable'];

$sql = "SELECT Subject_Category2 FROM $selectedTable"; // Assuming Subject_Category is a column in the selected table
$result = $conn->query($sql);

$data = array();

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $data[] = $row['Subject_Category2'];
    }
}

echo json_encode($data);

$conn->close();
?>
