public function handleForm($context, $action) { if ($action == "createAd") { if (isset($_POST['start']) && $_POST['start'] != "" && (isset($_POST['size']) && $_POST['size'] != "") && (isset($_POST['name']) && $_POST['name'] != "") && (isset($_POST['url']) && $_POST['url'] != "")) { $start = $_POST['start']; $dayOfWeek = date("D", strtotime($start)); if ($dayOfWeek == "Mon") { $splitStart = explode("/", $start); $mysqlStart = $splitStart[2] . "-" . $splitStart[0] . "-" . $splitStart[1]; if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { $filename = $this->saveSampleImage($context, $_FILES['image'], SessionUtil::getUsername()); if ($filename != "") { WebAdDao::createWebAd($_POST['name'], $mysqlStart, $_POST['size'], $filename, $_POST['url']); } else { $context->addError("Error Uploading File, Please Try Again."); } } else { $context->addError("No File Uploaded."); } } else { $context->addError("Starting Date Not a Monday."); } } else { $context->addError("Required Field Left Blank."); } } else { $context->addError("Incorrect Action."); } }