Bonjour à tous,

Je fais appel à votre aide pour un petit problème concernant une suppression à partir de checkbox....

Ce que je voudrais, c'est que lorsque je Check une Box et que je la valide avec un Boutton, l'action n'agit pas.... =(

voici mon code :

Code php : 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
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
<?php
           include'connect.php';
 header('Content-Type: text/html;charset=UTF-8');
 
 
if (isset($_POST['valider'])) {
 
$id=$_POST['id'];
$nom=$_POST['nom'];
$prenom=$_POST['prenom'];
$email=$_POST['email'];
 
}
 
 
/*****************************************************************/
/****           ON INSERT LES INFOS DANS LA TABLE            ****/
/***************************************************************/
 
$req =$pdo->prepare('INSERT INTO doub (id, nom, prenom, email) VALUES (?, ?, ?, ?)');
$req->execute(array($_POST['id'], $_POST['nom'], $_POST['prenom'], $_POST['email']));
 
 
 
 
 
/*****************************************************************/
/****           ON SELECTIONNE LES INFOS DANS LA TABLE       ****/
/***************************************************************/
 
 
$req1=$pdo->prepare("SELECT * from doub as d");
 
$req1->bindParam(':nom', $nom, PDO::PARAM_STR);
$req1->bindParam(':prenom', $prenom, PDO::PARAM_STR);
$req1->bindParam(':email', $email, PDO::PARAM_STR);
 
$req1->execute(array($nom,$prenom,$email));
 
 
/***************************************************************************/
/******				VALEURS DANS LE TABLEAU                  ********/
/**************************************************************************/
 
 
echo'<table border="1" frame="hsides">
		
		<tr align="center" height="40">
			<th><input type=checkbox name=<?php echo $id;?> </th>
			<th>Id</th>
			<th>Nom</th>
			<th>Prénom</th>
			<th>Email</th>
		</tr>';
 
 
	$resultats=$pdo->query('SELECT id,nom,prenom,email FROM doub'); // on va chercher tous les membres de la table
	foreach ($req1 as $value) {
 
		echo "<tr>";
 
			echo '<td><input type="checkbox" name="supprime[]" value="'.$value['id'] .'"</td>';
			echo "<td>".$value['id'].'&nbsp'."</td>";
			echo "<td>".$value['nom'].'&nbsp'."</td>";
			echo "<td>".$value['prenom'].'&nbsp'."</td>";
            echo "<td>".$value['email'].'&nbsp'."</td>";
 
 
		echo"</tr>";
	}
 
	$resultats->closeCursor(); // on ferme le curseur des résultats
 
	echo "</table>";
 
 
 
 
echo"<input type=submit value=Supprimer name=suppr>";
 
if (isset($_POST['suppr'])) {
 
		$pdo->execute('DELETE FROM doub WHERE id='.$_POST['id']);
 
	}