<?php

include "classes/league.class.php";
if (isset($_POST['save'])) {
    $oFixture = new fixture();
    $oFixture->datetime = $_POST['datetimepicker2'];
    $oFixture->gameweek = $_POST['gameweek'];
    $oFixture->league = $_POST['league'];
    $oFixture->hometeam = $_POST['hometeam'];
    $oFixture->awayteam = $_POST['awayteam'];
    $oFixture->oddhome = $_POST['oddhome'];
    $oFixture->odddraw = $_POST['odddraw'];
    $oFixture->oddaway = $_POST['oddaway'];
    switch ($oFixture->insert_fixture()) {
        case 'SUCCESS':
            $_SESSION['success_message'] = "Fixture Added Successfully!";
            echo "<script type=\"text/javascript\">window.location=\"home.php?page=fixture\"</script>";
            break;
        case 'ERROR':
            $_SESSION['error_message'] = "Error Occured. Please Try Again!";
            echo "<script type=\"text/javascript\">window.location=\"home.php?page=fixture\"</script>";
            break;
            // case 'FILL_THIS_FIELD':
            //     if ($oLogin->user=="")
            //         $oForm->setError('username','Please Fill the Username');
            //     elseif ($oLogin->pass=="")
            //         $oForm->setError('password','Please Fill the Password');
            //     break;
        // case 'FILL_THIS_FIELD':
        //     if ($oLogin->user=="")
        //         $oForm->setError('username','Please Fill the Username');