$article['title'], 'content' => $article['content'], 'writer' => $article['author_id'], 'event_date' => $article['event_date'], 'article_id' => $article['id'] ]; // Parse participants if (!empty($article['participants'])) { $participantIds = explode(',', $article['participants']); } else { $participantIds = []; } } // Get selected participants from old input $selectedParticipants = []; if (!empty($oldInput['participants'])) { if (is_array($oldInput['participants'])) { $selectedParticipants = $oldInput['participants']; } else { $selectedParticipants = [$oldInput['participants']]; } } elseif (isset($participantIds)) { $selectedParticipants = $participantIds; } // Check if we have an uploaded image in session or from old input $uploadedImage = null; if (isset($_SESSION['uploaded_image'])) { $uploadedImage = $_SESSION['uploaded_image']; unset($_SESSION['uploaded_image']); } elseif ($article && $article['article_image']) { $uploadedImage = $article['article_image']; } ?>