die("Location not found"); } else { $results = $location->results(); $GroundName = $location->first()->GroundName; $Town = $location->first()->Town; $PostCode = $location->first()->PostCode; $LocationId = $location->first()->LocationId; } } 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->updateLocation(array('GroundName' => Input::get('GroundName'), 'Town' => Input::get('Town'), 'PostCode' => Input::get('PostCode')), Input::get('LocationId')); Session::flash('LocationUpdated', 'Locaion Updated 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 />"; } } } }