<?php
if (isset($_POST['equipe']))
{
$equipe =$_POST['equipe'];
?>
<p style="text-align: center;">Modifier les stats de l\'<?php echo $equipe; ?></p>
<table style="width: 100px; text-align: center; margin-left: auto; margin-right: auto; white-space: nowrap;"
border="2" cellpadding="1" cellspacing="0">
<tbody>
<tr>
<td style="background-color: rgb(192, 192, 192);">Joueur</td>
<td style="background-color: rgb(192, 192, 192);"> G </a></td>
<td style="background-color: rgb(192, 192, 192);">PAB</td>
<td style="background-color: rgb(192, 192, 192);">AB</td>
<td style="background-color: rgb(192, 192, 192);"> R </td>
<td style="background-color: rgb(192, 192, 192);"> H </td>
<td style="background-color: rgb(192, 192, 192);">2B</td>
<td style="background-color: rgb(192, 192, 192);">3B</td>
<td style="background-color: rgb(192, 192, 192);">HR</td>
<td style="background-color: rgb(192, 192, 192);">RBI</td>
<td style="background-color: rgb(192, 192, 192);">BB</td>
<td style="background-color: rgb(192, 192, 192);">SB</td>
<td style="background-color: rgb(192, 192, 192);">CS</td>
<td style="background-color: rgb(192, 192, 192);"> K </td>
<td style="background-color: rgb(192, 192, 192);">GO</td>
<td style="background-color: rgb(192, 192, 192);">FO</td>
<td style="background-color: rgb(192, 192, 192);">Ae/Fc</td>
<td style="background-color: rgb(192, 192, 192);">HBP</td>
<td style="background-color: rgb(192, 192, 192);">SF</td>
<td style="background-color: rgb(192, 192, 192);">Sac</td>
<td style="background-color: rgb(192, 192, 192);">OBA</td>
<td style="background-color: rgb(192, 192, 192);">SLG</td>
<td style="background-color: rgb(192, 192, 192);">AVG</td>
<td style="background-color: rgb(192, 192, 192);">Valid</td>
</tr>
<?php
$dbhost ="localhost";
$dblogin ="root";
$dbpass ="";
$dbname ="test";
mysql_connect($dbhost, $dblogin, $dbpass);
mysql_select_db($dbname);
?>
<form action="modifier-stats.php" method="post">
<?php
$rep1 = mysql_query("SELECT * FROM marlins WHERE equipe='$equipe' ORDER BY name") or die(mysql_error()); //selection de l'equipe dans la BDD
while ($donnees = mysql_fetch_array($rep1)) // creation du tableau pour modifier les stats
{
?>
<tr>
<form action='modifier-stats.php' method='post'>
<td><?php echo $donnees['name']; ?></td>
<td><input type="text" value="<?php echo $donnees['G'];?>" size="3" name="G"></td>
<td><input type="text" value="<?php echo $donnees['PAB'];?>" size="3" name="PAB"></td>
<td><input type="text" value="<?php echo $donnees['AB'];?>" size="3" name="AB"></td>
<td><input type="text" value="<?php echo $donnees['R'];?>" size="3" name="R"></td>
<td><input type="text" value="<?php echo $donnees['H'];?>" size="3" name="H"></td>
<td><input type="text" value="<?php echo $donnees['2B'];?>" size="3" name="2B"></td>
<td><input type="text" value="<?php echo $donnees['3B'];?>" size="3" name="3B"></td>
<td><input type="text" value="<?php echo $donnees['HR'];?>" size="3" name="HR"></td>
<td><input type="text" value="<?php echo $donnees['RBI'];?>" size="3" name="RBI"></td>
<td><input type="text" value="<?php echo $donnees['BB'];?>" size="3" name="BB"></td>
<td><input type="text" value="<?php echo $donnees['SB'];?>" size="3" name="SB"></td>
<td><input type="text" value="<?php echo $donnees['CS'];?>" size="3" name="PCS"></td>
<td><input type="text" value="<?php echo $donnees['K'];?>" size="3" name="K"></td>
<td><input type="text" value="<?php echo $donnees['GO'];?>" size="3" name="GO"></td>
<td><input type="text" value="<?php echo $donnees['FO'];?>" size="3" name="FO"></td>
<td><input type="text" value="<?php echo $donnees['Ae/Fc'];?>" size="3" name="Ae/Fc"></td>
<td><input type="text" value="<?php echo $donnees['HBP'];?>" size="3" name="HBP"></td>
<td><input type="text" value="<?php echo $donnees['SF'];?>" size="3" name="SF"></td>
<td><input type="text" value="<?php echo $donnees['SAC'];?>" size="3" name="SAC"></td>
<td><input type="text" value="<?php echo $donnees['OBA'];?>" size="3" name="OBA"></td>
<td><input type="text" value="<?php echo $donnees['SLG'];?>" size="3" name="SLG"></td>
<td><input type="text" value="<?php echo $donnees['AVG'];?>" size="3" name="AVG"></td>
<td><input type='submit' value="ok"></td>
</form>
</tr>
<?php
}
?>
</tbody>
</table><br>
<div style="text-align: center;"><input type="submit" value="OK POUR TOUT"></div>
</form>
<br><br><br><?php
//////////////// verification des valeurs et modification de la BDD ////////////
if (isset($_POST['G']) && isset($_POST['PAB']) && isset($_POST['AB']) && isset($_POST['R']) && isset($_POST['H']) && isset($_POST['2B']) && isset($_POST['3B']) && isset($_POST['HR']) && isset($_POST['RBI']) && isset($_POST['BB']) && isset($_POST['SB']) && isset($_POST['K']) && isset($_POST['GO']) && isset($_POST['FO']) && isset($_POST['Ae/Fc']) && isset($_POST['HBP']) && isset($_POST['SF']) && isset($_POST['SAC']) && isset($_POST['OBA']) && isset($_POST['SLG'])&& isset($_POST['AVG']))
{
$name=$donnees['name'];
$G= $_POST['G'];
$PAB= $_POST['PAB'];
$AB= $_POST['AB'];
$R= $_POST['R'];
$H= $_POST['H'];
$B2= $_POST['2B'];
$B3= $_POST['3B'];
$HR= $_POST['HR'];
$RBI= $_POST['RBI'];
$SB= $_POST['SB'];
$BB= $_POST['BB'];
$CS= $_POST['CS'];
$K= $_POST['K'];
$GO= $_POST['GO'];
$FO= $_POST['FO'];
$AeFc= $_POST['Ae/Fc'];
$HBP= $_POST['HBP'];
$SF= $_POST['SF'];
$SAC= $_POST['SAC'];
$OBA= $_POST['OBA'];
$SLG= $_POST['SLG'];
$AVG= $_POST['AVG'];
mysql_query("UPDATE `marlins` SET `G`='$G', `PAB`='$PAB', `AB`='$AB', `R`='$R', `H`='$H', `2B`='$B2', `3B`='$B3', `HR`='$HR', `RBI`='$RBI', `BB`='$BB', `CS`='$CS', `K`='$K', `GO`='$GO', `CS`='$CS', `FO`='$FO', `Ae/Fc`='AeFc' `HBP`='$HBP', `SF`='$SF', `SAC`='$SAC', `OBA`='$OBA', `SLG`='$SLG', `AVG`='$AVG' WHERE `name` ='$name'")or die(mysql_error());
echo "Tout c'est bien derouler ! Les infos de $name on ete modifier !";
}}?> |