echo "<br>Their player ID is: {$playerID}";
                        echo "<br>Congratulations! {$fname} {$lname} is now part of your team!";
                        echo '<br>Player has been set as #4';
                        $sql = "UPDATE team SET Player_4 = {$playerID} where team.Team_ID = {$teamID}";
                        $message = 'Player has been added to 4th player slot! You can only add one more person to your team!';
                    } elseif (!isset($row2['Player_5'])) {
                        echo 'You are trying to add the e-mail ' . $_POST['myinput'], ' to your team';
                        echo "<br>Their player ID is: {$playerID}";
                        echo "<br>Congratulations! {$fname} {$lname} is now part of your team!";
                        echo '<br>Player has been set as #5';
                        $sql = "UPDATE team SET Player_5 = {$playerID} where team.Team_ID = {$teamID}";
                        $message = 'Player has been added to 5th player slot! You are currently maxed out on other team members!';
                    } else {
                        $message = 'Your team is full, therefore you are unable to add any more players. Please remove some members off of your team if you want room to add other players.';
                        $isFull = true;
                    }
                    popupMessageAndRedirectBrowser($message);
                }
            }
        }
    }
    if (!$isFull and attemptDataManipulationLanguageQuery($sql)) {
        emailPlayer($playerID);
        echo '<br>Player Added';
    } else {
        $message = 'Unable to add the player! ';
    }
    popupMessageAndRedirectBrowser($message);
} else {
    popupMessageAndRedirectBrowser('Player does not exist! Please ensure that what you have entered is correct and valid.   ');
}
    </head>

    <body>
    <?php 
    include 'menuBar.php';
    generateMenuBar(basename(__FILE__));
    include 'databaseFunctions.php';
    $conn = connectToDatabase();
    function popupMessageAndRedirectBrowser($message)
    {
        echo "<script type='text/javascript'>alert('{$message}');history.go(-2);document.location = 'createGame.php';</script>";
    }
}
?>

<?php 
$inputLocation = $_POST['locationInput'];
$inputAddress = $_POST['addressInput'];
if (strlen($inputLocation) < 8 or strlen($inputAddress) < 8) {
    $message = 'Invalid form. Please try to enter a location and address of 8 characters of more.';
} else {
    $sql = "INSERT into game_location(Game_Location_Name, Game_Address) VALUES ('{$inputLocation}','{$inputAddress}')";
    if (attemptDataManipulationLanguageQuery($sql)) {
        echo '<br>New Location Added!';
        $message = 'New Game Location has been added!';
    } else {
        $message = 'Could not add location!';
    }
}
popupMessageAndRedirectBrowser($message);