OK, I made the change like you showed but then now it is going into the
doRainout function when I just LOAD the page.
It just goes into doRainout, echoes "in doRainout" and dies...
<html>
<head>
<title>
AMBL game change page
</title>
</head>
<body onload="document.baseform.gameid_1.focus();">
<?php
$debug = true;
include("board/db/mysql.php");
include("../dbconnect.inc");
$db = new dbstuff;
//if ($_POST["gameid_1"]=='') $gameid_1=1;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, '');
define ("NL", "<br />\n");
if ( isset($_POST["g_change"] ) )
{
$change_type = $_POST["g_change"];
}
$rainout = false;
echo '<form name="baseform" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
echo ' <fieldset>';
echo ' <legend>';
echo ' Game Numbers:';
echo ' </legend>';
echo ' <input type="text" name="gameid_1" size="4" maxlength="4"> ';
echo ' <input type="text" name="gameid_2" size="4" maxlength="4"><br /><br />';
echo ' </fieldset>';
echo ' <br />';
$sql = 'SELECT id, teamname '
. 'FROM teams '
. 'WHERE active = 1 '
. 'ORDER BY teamname';
$query = $db->query($sql);
echo ' <fieldset>';
echo ' <legend>';
echo ' Teams:';
echo ' </legend>';
echo ' <select name="team1" size="1">';
while (list($id, $teamname)=$db->fetch_row($query))
{
// want to add OPEN at bottom so skip here Keeps the 40 option from
// being added during the loop.
if ($id <> 40)
{
echo ' <option value="' . $id . '">' . $teamname . '</option>';
}
}
echo ' <option value="40">OPEN</option>';
echo ' </select> Team 1 ';
//echo ' <br /><br />';
$query = $db->query($sql);
echo ' <select name="team1" size="1">';
while (list($id, $teamname)=$db->fetch_row($query))
{
// want to add OPEN at bottom so skip here Keeps the 40 option from
// being added during the loop.
if ($id <> 40)
{
echo ' <option value="' . $id . '">' . $teamname . '</option>';
}
}
echo ' <option value="40">OPEN</option>';
echo ' </select> Team 2<br /><br />';
echo ' </fieldset>';
echo ' <br />';
echo ' <fieldset>';
echo ' <legend>';
echo ' Switch Type:';
echo ' </legend>';
echo ' <input type="radio" name="g_change" value="0">Rainout ';
echo ' <input type="radio" name="g_change" value="1">Game Switch ';
echo ' <input type="radio" name="g_change" value="2">Team Switch ';
echo ' <input type="radio" name="g_change" value="3">Cancel ';
echo ' <input type="radio" name="g_change" value="4">Clear Game Scores<br /><br />';
echo ' </fieldset>';
echo ' <input type="submit" name="Submit" value="Edit this game">';
echo '</form>';
echo '</body>';
echo '</html>';
switch ($change_type)
{
case 0:
doRainout();
// No need to send out confirmation emails for Rainouts...
break;
case 1:
doGameSwitch();
SendConfirmationEmails($change_type);
break;
case 2:
doTeamSwitch();
SendConfirmationEmails($change_type);
break;
case 3:
doCancel();
SendConfirmationEmails($change_type);
break;
case 4:
clearGameScores();
break;
}
function doGameSwitch() {
echo "in doGameSwitch";
}
function doTeamSwitch() {
echo "in doTeamSwitch";
}
function doRainout() {
echo "in doRainout";
$rainout = true;
if ( isset($_POST["gameid_1"]) ) {
$game_num = $_POST["gameid_1"];
$sql = 'update games set';
$sql = $sql.' homescore=999, visitorscore=999 where gamenum='.$game_num;
$query = $db->query($sql);
} else {
die("You must select a game to Rainout");
}
}
function doCancel() {
echo 'in doCancel';
if ( isset($_POST["gameid_1"]) ) {
$game_num = $_POST["gameid_1"];
$sql = 'update games set';
$sql = $sql.' homescore=777, visitorscore=777 where gamenum='.$game_num;
$query = $db->query($sql);
} else {
die("You must select a game to Cancel");
}
}
function clearGameScores() {
echo "in clearGameScores";
if ( isset($_POST["gameid_1"]) ) {
$game_num = $_POST["gameid_1"];
$sql = 'update games set';
$sql = $sql.' homescore=null, visitorscore=null where gamenum='.$game_num;
} else {
die("You must select a game to Clear");
}
}
function SendConfirmationEmails($change_type) {
echo "Sending Confirmation Emails for ".$change_type;
}
?>