<?php require_once 'core/init.php'; $pageTitle = 'Update a Location'; $user = new User(); if (!$user->isLoggedIn()) { Redirect::to('login.php'); } // Defaults $style = ''; $displayErrors = "none"; $errorDisplay = ""; $leagueOptions = new League(); if (isset($_GET['locationid']) && is_numeric($_GET['locationid'])) { $location = $leagueOptions->getLocationById(escape($_GET['locationid'])); if (!$location) { 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 {