<?php require_once 'core/init.php'; $pageTitle = 'Update a Fixture'; $user = new User(); if (!$user->isLoggedIn()) { Redirect::to('login.php'); } // Defaults $style = ''; $displayErrors = "none"; $errorDisplay = ""; $fixture = new Fixture(); if (isset($_GET['matchId']) && is_numeric($_GET['matchId'])) { $fixtures = $fixture->getMatch(escape($_GET['matchId'])); if ($fixtures->count()) { $results = $fixture->getMatch(escape($_GET['matchId']))->results(); } else { die("Match not found"); } } if (Input::exists()) { if (Token::check(Input::get('token'))) { $validate = new Validation(); $validation = $validate->check($_POST, array('homeScore' => array('name' => 'Home Score', 'required' => true), 'awayScore' => array('name' => 'Away Score', 'required' => true), 'result' => array('name' => 'Result', 'required' => true))); if ($validation->passed()) { $score = Input::get('homeScore') . " - " . Input::get('awayScore'); try { $fixture->update(array('Score' => $score, 'Result' => Input::get('result')), Input::get('matchId')); Session::flash('fixtureUpdated', 'Fixture Updated Successfully'); Redirect::to('fixtures.php');