I have a problem, im making the team selection for my footie game but what i want to be able to do is list all of the players which i have done. But i want to be pick a goalkeeper and then disable all other goalkeepers until the one i picked has been click again. Bearing in mind there will be a various number of goalkeepers!
ive had a go myself but the code doesnt seem to uncheck all the boxes after ive checked one and disabled the rest. Ive used on click on the checkbox to do the "DoTheCheck()";
PHP Code:
<script language="javascript"> function DoTheCheck() { <?php $sql = mysql_query("SELECT * FROM `manager__players` WHERE `team_id` = '" . $_SESSION['team_id'] . "' && `position` = 'GK'"); while($row = mysql_fetch_array($sql)) { echo "if(document.myform.player_" . $row['player_id'] . " .checked == true) {"; $dis = mysql_query("SELECT * FROM `manager__players` WHERE `team_id` = '" . $_SESSION['team_id'] . "' && `position` = 'GK' && `player_id` != '" . $row['player_id'] . "'"); while($row2 = mysql_fetch_array($dis)) { echo "document.myform.player_" . $row2['player_id'] . ".disabled = true; "; } echo "}"; echo "if(document.myform.player_" . $row['player_id'] . ".checked == false) {"; $dis = mysql_query("SELECT * FROM `manager__players` WHERE `team_id` = '" . $_SESSION['team_id'] . "' && `position` = 'GK'"); while($row2 = mysql_fetch_array($dis)) { echo "document.myform.player_" . $row2['player_id'] . ".disabled = false; "; } echo "}"; } ?> } </script>
</span>
|