1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| <?php
echo include ("test.php");
echo "<br><br>";
include ("include.php");
ini_set('display_errors',1) ;
ini_set('error_reporting','E_ALL|E_STRICT') ;
echo $_GET[Nom_client]."<br>";
echo $_POST[Categ]."<br>";
echo $_POST[Mail]."<br>";
echo $_POST[Id]."<br>";
echo $_POST[Mdp]."<br>";
echo $_POST[Cmdp]."<br>";
if ( $_GET[action]=="suppr")
{
$requetespeciale="DELETE FROM client WHERE Nom_client='$_GET[Nom_client]'";
mysql_query($requetespeciale, $connection);
} elseif ($_GET[action]=="modif"){
$requetespecial=" UPDATE client SET Nom_client = '$_GET[Nom_client]',Categ = '$_POST[Categ]',Mail = '$_POST[Mail]',Id = '$_POST[Id]',Mdp = '$_POST[Mdp]',Cmdp = '$_POST[Cmdp]'
WHERE Nom_client = '$_GET[Nom_client]' ";
//echo $requetespecial;
mysql_query($requetespeciale, $connection);
//il suffit d'ajouter une comparaison de la variable $_GET[action] sur la chaîne "insert" comme vous l'avez déjà fait avec les autres
}elseif ($_GET[action]=="insert")
{
//envoie la requête qui va bien avec la fonction qui va bien
$requetespeciale="INSERT client SET Nom_client='', Categ='$_POST[Categ]', Mail='$_POST[Mail]',Id='$_POST[Id]',Mdp='$_POST[Mdp]',Cmdp='$_POST[Cmdp]'";
mysql_query($requetespeciale, $connection);
}
$requete="SELECT * FROM client ORDER BY Nom_client";
echo $requete;
$resultat=mysql_query ($requete,$connection);
//echo $resultat;
?>
<table border="1" width="685" align="center">
<tr align="center">
<td width="20%"><b>Nom_client</b></font></td>
<td width="35%"><b>Categ</b></font> </td>
<td width="25%"><b>Mail</b></font></td>
<td width="25%"><b>Id</b></font></td>
<td width="25%"><b>Mdp</b></font></td>
<td width="25%"><b>Cmdp</b></font></td>
<td><b></b></td>
<td><b></b></td>
</tr>
<?php
//affichage :
while($test=mysql_fetch_row($resultat)){
//$Nom_client=$test[0];
//$Categ=$test[1];
//$Mail=$test[2];
//$Id=$test[3];
//$Mdp=$test[4];
//$Cmdp=$test[5];
list($Nom_client,$Categ,$Mail,$Id,$Mdp,$Cmdp)=$test;
if ($_GET[action]!="modif"){
echo " <tr align='center' bgcolor=#92BCOB>";
echo '<td>';
echo MetsEnMajuscules($Nom_client);
echo '</td><td>';
echo $Categ;
echo '</td><td>';
echo ArrangeLeTexte($Mail);
echo '</td><td>';
echo $Id;
echo '</td><td>';
echo $Mdp;
echo '</td><td>';
echo $Cmdp;
//créons le lien vers la page execute.php (la page en cours)
echo "<td><a href='execute.php?Nom_client=$Nom_client&action=suppr'><img src='supprimer.gif'></a></td>";
//on ajoute un lien vers la page afficher_clt.php
echo "<td><a href='modifier_clt.php?Nom_client=$Nom_client&action=modif'><img src='modifier.gif'></a></td>";
echo '</tr>';
}else
{
echo " <tr align='center' bgcolor=#92BCOB>";
echo '<td>';
echo $_POST['Nom_client'];
echo '</td><td>';
echo $_POST['Categ'];
echo '</td><td>';
echo $_POST['Mail'];
echo '</td><td>';
echo $_POST['Id'];
echo '</td><td>';
echo $_POST['Mdp'];
echo '</td><td>';
echo $_POST['Cmdp'];
//créons le lien vers la page execute.php (la page en cours)
echo "<td><a href='execute.php?Nom_client=$Nom_client&action=suppr'><img src='supprimer.gif'></a></td>";
//on ajoute un lien vers la page afficher_clt.php
echo "<td><a href='modifier_clt.php?Nom_client=$Nom_client&action=modif'><img src='modifier.gif'></a></td>";
echo '</tr>';
}
} ?>
<tr><td><a href='modifier_clt.php?action=insert'><img src='ajouter.gif' /></a></td></tr>
</table> |
Partager