load(); header('Content-Type: application/json'); try { $db = getDbConnection(); // Get POST data $input = json_decode(file_get_contents('php://input'), true); if (!$input) { $input = $_POST; } // Validate required fields if (empty($input['id'])) { jsonResponse([ 'success' => false, 'error' => 'Missing transmission ID' ], 400); } // Check if transmission exists $stmt = $db->prepare("SELECT id FROM transmissions WHERE id = ?"); $stmt->execute([$input['id']]); if (!$stmt->fetch()) { jsonResponse([ 'success' => false, 'error' => 'Transmission not found' ], 404); } // Delete transmission $stmt = $db->prepare("DELETE FROM transmissions WHERE id = ?"); $stmt->execute([$input['id']]); jsonResponse([ 'success' => true, 'message' => 'Transmission deleted successfully' ]); } catch (Exception $e) { jsonResponse([ 'success' => false, 'error' => $e->getMessage() ], 500); }