Jump to content

Trying to allow multiple id processing with one submission.


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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.