$logger->LogInfo("Form has been submitted."); $sliderImage = SliderImage::fetchFromParameters($_POST, $_FILES); if (!$sliderImage->save()) { $logger->LogError("Error saving slider image."); foreach ($sliderImage->errors as $error) { $logger->LogError($error); $errors[] = $error; } } else { header("Location: slider_images_list.php"); } } else { if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) { $imageId = intval($_REQUEST['id']); $logger->LogInfo("Page was called for image edit of slider image id: {$imageId}"); $sliderImage = SliderImage::fetchFromDb($imageId); if ($sliderImage == null) { $logger->LogError("Invalid request. No gallery slider image with id: {$imageId} exists."); $errors[] = "Invalid request. No gallery slider image with id: {$imageId} exists."; } } } include "header.php"; ?> </td> <tr> <td valign="top"> <?php if (sizeof($errors) > 0) { echo ' <table width="100%">' . "\n"; foreach ($errors as $error) {