find($id); if (!$row) { echo '
找不到這筆資料。
'; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $row['title'] = trim($_POST['title'] ?? $row['title']); $row['type'] = $_POST['type'] ?? $row['type']; $row['platform'] = $_POST['platform'] ?? $row['platform']; $row['watch_url'] = trim($_POST['watch_url'] ?? ''); $row['current_season'] = max(1, (int)($_POST['current_season'] ?? 1)); $row['current_episode'] = max(0, (int)($_POST['current_episode'] ?? 0)); $row['current_position'] = trim($_POST['current_position'] ?? ''); $row['progress_note'] = trim($_POST['progress_note'] ?? ''); $row['status'] = $_POST['status'] ?? $row['status']; $row['rating'] = ($_POST['rating'] !== '') ? $_POST['rating'] : ''; $row['intro'] = trim($_POST['intro'] ?? ''); $row['note'] = trim($_POST['note'] ?? ''); $Drama->save($row); to("?do=drama"); exit; } ?>