Page refresh issue

First off I would like to thank anyone who might be able to help me with this. I’m building a page for my fantasy football league draft this August. Basically, it shows who’s on the clock, the last selection, the upcoming picks, and it has a drop down to pick a postion to choose the players from. It works, but not the way I want it too. I’m hoping to make is so that when you select a player with the “Make Pick” button, the Last Pick, On the Clock, Next picks listed at the top will refresh. They will refresh when you select a new position to to choose from, but I want it to happen when I make the pick.

Feel free to use the software here:
http://www.shermanffl.com/drafttrackerbf.php

Here is the code:


<?php

$user = "***";
$pass = "***";
$db = "***";
$link = mysql_connect( "***", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
mysql_select_db( $db, $link )
or die ( "Couldn't open $db: ".mysql_error() );
$rows = mysql_query( "SELECT * FROM counter" );
$draftcounter = mysql_num_rows( $rows );
$draftcounterlast = $draftcounter - 1;
$draftcounter1 = $draftcounter + 1;
$draftcounter2 = $draftcounter + 2;
$draftcounter3 = $draftcounter + 3;
$draftcounter4 = $draftcounter + 4;

$result = mysql_query( "SELECT * FROM draft WHERE id = '$draftcounter' " );
$a_row = mysql_fetch_array( $result );
$file = $a_row[team].'.bmp';

$result1 = mysql_query( "SELECT * FROM draft WHERE id = '$draftcounter1' " );
$a_row1 = mysql_fetch_array( $result1 );

$result2 = mysql_query( "SELECT * FROM draft WHERE id = '$draftcounter2' " );
$a_row2 = mysql_fetch_array( $result2 );

$result3 = mysql_query( "SELECT * FROM draft WHERE id = '$draftcounter3' " );
$a_row3 = mysql_fetch_array( $result3 );

$result4 = mysql_query( "SELECT * FROM draft WHERE id = '$draftcounter4' " );
$a_row4 = mysql_fetch_array( $result4 );

$resultLast = mysql_query( "SELECT * FROM draft WHERE id = '$draftcounterlast' " );
$a_rowLast = mysql_fetch_array( $resultLast );

mysql_close( $link );

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<style type="text/css">
<!--
body,td,th {
	color: #FFFFFF;
}
body {
	background-color: #000000;
}
.style7 {font-size: 24px}
.style8 {
	color: #0000CC;
	font-size: 36px;
}
.style11 {
	font-size: 36px;
	color: #FFFF00;
}
.style12 {
	font-size: 36px;
	color: #FF0000;
}
-->
</style>

</head>

<body>
<table width="950" border="0" align="center" cellpadding="1">
  <tr>
    <td width="271"><p class="style7"><span class="style8">Last Selection:</span><br />
    	Round: <?php print"$a_rowLast[round]"; ?> 
		Pick: <?php print"$a_rowLast[pick]"; ?>
		<br />
		Team: <?php print"$a_rowLast[team]"; ?>
								<br />
      	Player: <?php print"$a_rowLast[selection]"; ?><br />
        <?php print"$a_rowLast[pos]"; ?> <?php print"$a_rowLast[nflteam]"; ?>
	</p>      </td>
    <td width="316" align="left" valign="top"><span class="style7"><span class="style12">On The Clock: </span></span><br />
    <span class="style12"> Round: <?php print"$a_row[round]"; ?> Pick: <?php print"$a_row[pick]"; ?> <?php print"$a_row[team]"; ?> <?php print"<img src = "images/$file">"; ?></span></td>
    <td width="349" align="left" class="style7">
	<span class="style11">Upcoming
Selections: </span><br />
	R: <?php print"$a_row1[round]"; ?> 
	P: <?php print"$a_row1[pick]"; ?> 
	Team: <?php print"$a_row1[team]"; ?><br />
    R: <?php print"$a_row2[round]"; ?> 
	P: <?php print"$a_row2[pick]"; ?> 
	Team: <?php print"$a_row2[team]"; ?><br />
    R: <?php print"$a_row3[round]"; ?> 
	P: <?php print"$a_row3[pick]"; ?> 
	Team: <?php print"$a_row3[team]"; ?><br />
    R: <?php print"$a_row4[round]"; ?> 
	P: <?php print"$a_row4[pick]"; ?> 
	Team: <?php print"$a_row4[team]"; ?></td>
  </tr>
</table>

<br />
<?php require_once("dt.php"); ?>

</body>
</html>


<?php

require_once("tabs.php");

?>

<html>

<head>

<?php tabs_header(); ?>


<style type="text/css">
<!--
body,td,th {
	color: #FFFFFF;
	font-size: 24px;
}
body {
	background-color: #000000;
}
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #FFFFFF;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
-->
</style>

</head>

<body>

<div style="width:950px;">

<?php tabs_start(); 

$pos = array('QB', 'RB', 'WR', 'TE', 'K', 'DST', 'All');

for ($x = 0; $x < 7; $x++)
{

tab( "$pos[$x]" ); 
{
$count = 1;
$user = "***";
$pass = "***";
$db = "***";
$link = mysql_connect( "***", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
mysql_select_db( $db, $link )
or die ( "Couldn't open $db: ".mysql_error() );
if ($pos[$x] == "All")
$resultBuildGrid = mysql_query( "SELECT * FROM allplayers WHERE sfflteam = 'Free Agent' ORDER BY `id` ASC " );
else
$resultBuildGrid = mysql_query( "SELECT * FROM allplayers WHERE pos = '$pos[$x]' AND sfflteam = 'Free Agent' ORDER BY `id` ASC " );
print "<table border=1 Width="100%">n";

print "<form method="post" action="drafttrackerbf.php">n";
print "<input type="submit" name="submitselection" value="Make Pick">n";


while ( $a_rowPos = mysql_fetch_array( $resultBuildGrid ) )
{
if ($count == 1)
print "<tr>n";

print "<td><input type="radio" name="selection" value="$a_rowPos[id]"/> $a_rowPos[first] $a_rowPos[last] $a_rowPos[nflteam]</td>n";


if ($count == 3)
{
print "</tr>n";
$count = 0;
}

$count++;
}
print "</form>n";
print "</table>n";
}

}

tabs_end(); 

if (isset($_POST['submitselection']))
{
$reload = 1;
$selid = ($_POST['selection']);
$selection = mysql_query("SELECT * FROM allplayers WHERE id = '$selid' ");
$selectionresults = mysql_fetch_array( $selection );
mysql_query("UPDATE allplayers SET sfflteam = '$selectionresults[team]' WHERE allplayers.id = '$selectionresults[id]' ");
mysql_query("UPDATE draft SET selection = '$selectionresults[first] $selectionresults[last] ', nflteam = '$selectionresults[nflteam]', pos = '$selectionresults[pos]' WHERE draft.overall = '$draftcounter'");
mysql_query("INSERT INTO counter (`id`, `draftcounter`) VALUES (NULL, '$draftcounter1')"); 
}

mysql_close( $link );
?>
</body>

</html>

Thanks again for any help. Sorry if the code is written poorly. I’m learning and sometimes I turn things into “ugly” code by trying different things.

Thanks,

Chris

Well, I dunno anything about football, but it sounds like you’re looking for the ‘onchange’ attribute in the tag.

Tried that, but no luck. Thanks for trying though.

Sponsor our Newsletter | Privacy Policy | Terms of Service