Je dois développer un script de suppression d'utilisateurs stockés dans une table (ici table1).
Je pense qu'il me manque quelque chose au niveau du IF, mais je ne sais pas trop comment faire.
Voici mon code pour la suppression :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <html> <?php $connex = mysql_connect ("localhost", "root","") or die ("erreur de connexion"); mysql_select_db ("test1"); $req="delete from table1"; If ($_POST['TSUPP[]'] == 'on') { $resultat=mysql_query($req) or die($req); } ?> <FORM method="POST" action=""> <table border='1'> <tr> <td>Suppression</td> <td>Numéro</td> <td>Login</td> <td>Mot de passe</td> </tr> <?php $sql="select * from table1"; $id=mysql_query($sql); while ($tab = mysql_fetch_array($id)) { ?> <tr> <td><input type="checkbox" name="TSUPP[]" value="<?php echo $_POST['num']; ?>"</td> <td><?php echo $tab['num']; ?></td> <td><?php echo $tab['nom']; ?></td> <td><?php echo $tab['pass']; ?></td> </tr> <?php } ?> </table> <br> <br> <input type="submit" name="supprimer" value="Supprimer"> </form> </body> </html>






Répondre avec citation






Partager