Help my data keeps disappearing
Posted: Tue Jul 06, 2010 3:59 am
Hi All
I am looking for a bit of help.
What am trying to do is a page where can input 10 pin bowling scores, so what I want to do is to have two drop down menus one to select team 1 and another to select team 2, When you select the first team page refreshes and you have a player list for team 1 , but when I do the same for the second team all the team and players for the first team you have just selected get removed and when I select the first team again the second team and there players disappear.
Any help with my problem would be gratefully appreciated.
Please see code below.
[text][text][text][/text][/text][/text]
I am looking for a bit of help.
What am trying to do is a page where can input 10 pin bowling scores, so what I want to do is to have two drop down menus one to select team 1 and another to select team 2, When you select the first team page refreshes and you have a player list for team 1 , but when I do the same for the second team all the team and players for the first team you have just selected get removed and when I select the first team again the second team and there players disappear.
Any help with my problem would be gratefully appreciated.
Please see code below.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<?php
// open connection
include 'connection4.php';
//if(isset($_POST['TEAMNAME']) && $_POST['TEAMNAME']) $TEAMNAME = $_POST['TEAMNAME'];
if(isset($_POST['TEAMNAME']) && $_POST['TEAMNAME']) $TEAMNAME1 = $_POST['TEAMNAME'];
if(isset($_POST['TEAM2']) && $_POST['TEAM2']) $TEAMNAME2 = $_POST['TEAM2'];
if(isset($_POST['TEAMNAME2']) && $_POST['TEAMNAME2']) $TEAMNAME3 = $_POST['TEAMNAME2'];
if(isset($_POST['PLAYERNAME']) && $_POST['PLAYERNAME']) $PLAYERNAME = $_POST['PLAYERNAME'];
if(isset($_POST['T2PLAYER']) && $_POST['T2PLAYER']) $PLAYERNAME2 = $_POST['T2PLAYER'];
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="robtest1.css" />
</head>
<body>
<div id="wrapper">
<fieldset>
<legend>Book RMA</legend>
<?php
include 'menus.php';
?>
<br>
<br>
<br>
<form action="scoresheet_test.php" method="POST">
<div>
<div class="mytext3"><b>Team One</b></div>
<select name="TEAMNAME" onChange="submit();">
<?php
/****************************************************************
*
* Team One Selection
*
/***************************************************************/
echo"<option>$TEAMNAME</option>";
$query1 = "SELECT DISTINCT TEAMNAME FROM teamlist ORDER BY TEAMNAME ASC";
$result1 = mysql_query($query1);
$num_rows=mysql_num_rows($result1);
while ($row=mysql_fetch_array($result1))
{
$TEAMNAME = $row["TEAMNAME"];
echo "<option value=\"$TEAMNAME\">$TEAMNAME</option>";
}
echo "</select><br></div>";
$query15 = "SELECT * FROM playerlist where TEAMNAME = '$TEAMNAME1'";
$result15 = mysql_query($query15);
if($num=mysql_numrows($result15))
{
while ($record = mysql_fetch_array($result15))
{
$PLAYERNAME = $record["PLAYERNAME"];
echo "$PLAYERNAME<br>";
}
}
echo "query15 = $query15";
echo "</form>";
/****************************************************************
*
* Team Two Selection
*
/***************************************************************/
echo "<form action=\"scoresheet_test.php\" method=\"POST\"><div>";
echo "<div class=\"mytext3\"><b>Team Two</b></div>";
echo "<select name=\"TEAMNAME2\" onChange=\"submit();\">";
echo"<option></option>";
$query1 = "SELECT DISTINCT TEAMNAME as TEAM2 FROM teamlist ORDER BY TEAMNAME ASC";
$result1 = mysql_query($query1);
$num_rows=mysql_num_rows($result1);
while ($row=mysql_fetch_array($result1))
{
$TEAMNAME2 = $row["TEAM2"];
echo "<option value=\"$TEAMNAME2\">$TEAMNAME2</option>";
}
echo "</select><br></div>";
$query16 = "SELECT PLAYERNAME as T2PLAYER FROM playerlist where TEAMNAME = '$TEAMNAME3'";
$result16 = mysql_query($query16);
if($num=mysql_numrows($result16))
{
while ($record = mysql_fetch_array($result16))
{
$PLAYERNAME2 = $record["T2PLAYER"];
echo "$PLAYERNAME2<br>";
}
}
echo "Query16 = $query16";
echo "</form>";
?>
</div>
</div>
</form>
</div>
</body>
</html>