Jump to content

Trying to allow multiple id processing with one submission.


hofdiggity

Recommended Posts

Hello,

 

I am looking into PokerMax Poker League PHP Script (http://www.stevedawson.com/pokermax-poker-league.php), and I am looking into modifying one file (players-to-tournaments.php).

 

Here is the issue:  Currently, the admin can only add one playerid to a specified tournament per submission.  I would like to be able to either checkbox or highlight multiple playerids to a specified tournament per submission.

 

Here is the form:

<form method="post">
<input name="op" type="hidden" value="AssignPlayer">
<select name="playerid" size="1">
<option value="">Select Player ....</option>
<?PHP 

    $rows = $sql->execute (
      "SELECT * FROM " . $player_table .
      " ORDER BY playerid ASC", SQL_RETURN_ASSOC );

    for ( $i = 0; $i < sizeof ( $rows ); ++$i )
    {
      $row = $rows [ $i ];
      
      ?>
<option value="<?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?>">
<?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?> - <?php echo $cgi->htmlEncode ( $row [ "name" ] ); ?>
</option>
<?php
    }

?>
</select> 
  <em>and assign to the tournament =></em>  
<select name="tournamentid" size="1">
<option value="">Select Tournament ....</option>
<?PHP 

    $rows = $sql->execute (
      "SELECT * FROM " . $tournament_table .
      " ORDER BY id DESC", SQL_RETURN_ASSOC );

    for ( $i = 0; $i < sizeof ( $rows ); ++$i )
    {
      $row = $rows [ $i ];
      
      ?>
<option value="<?php echo $cgi->htmlEncode ( $row [ "tournamentid" ] ); ?>">
<?php echo $cgi->htmlEncode ( $row [ "tournament_name" ] ); ?>
</option>
<?php
    }

?>
</select>   <input type="submit" value="Assign Player"  ONCLICK="return confirm('Are you sure you want to add this player to the tournament?');" />
</form>

 

This is the action:

<?php

  if ( $cgi->getValue ( "op" ) == "AssignPlayer" )
  {

  $result = mysql_query("SELECT playerid FROM ".$score_table." WHERE playerid = " . $sql->quote ( $cgi->getValue ( "playerid" ) ) . " AND tournamentid = " . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . "") or die ("$DatabaseError"); 
$chkd_email = mysql_numrows($result);

if ($chkd_email != "") {
print "<p class=\"red\"><strong>The Player has already been assigned to this tournament</strong></p>";
}
else {

  mysql_query("INSERT INTO ".$score_table." VALUES (
'',
" . $sql->quote ( $cgi->getValue ( "playerid" ) ) . ",
" . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . ",
'0',
'$dateadded'
)") or die ("$DatabaseError"); 
    ?>
<br>
<p align="center" class="red">The player <strong><?php echo $_POST['playerid']; ?></strong> has been assigned to the poker tournament.</p>
<?php
  }
  }
?>

 

Thank you for your time and consideration.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.