$leagueOptions->deleteLocation($locationId); Session::flash('deleted', 'Location Deleted Successfully'); Redirect::to('locations.php'); } catch (Exception $e) { die($e->getMessage()); } } else { $locationResults = $leagueOptions->getLocations(); } if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new Validation(); $validation = $validate->check($_POST, array('GroundName' => array('name' => 'Ground Name', 'min' => 5, 'max' => 50, 'required' => true), 'Town' => array('name' => 'Town', 'min' => 3, 'max' => 50), 'PostCode' => array('name' => 'Postcode', 'min' => 3, 'max' => 10))); if ($validation->passed()) { try { $leagueOptions->createLocation(array('GroundName' => Input::get('GroundName'), 'Town' => Input::get('Town'), 'PostCode' => Input::get('PostCode'))); Session::flash('locationCreation', 'Location created Successfully'); Redirect::to('locations.php'); } catch (Exception $e) { die($e->getMessage()); } $displayErrors = "none"; } else { $errorDisplay = ""; $displayErrors = "block"; foreach ($validation->errors() as $error) { $errorDisplay = $errorDisplay . $error . "<br>"; } echo $errorDisplay; } }