Bonjour à tous,

j'ai un tableau avec des informations récupérées à travers une requête sql. Je veux faire une sélection de certaines informations à retraiter et à afficher dans un autre tableau à travers un checkbox et l'ID.

Alors mon souci se situe au niveau de la récupération, je constate que toutes les informations sélectionnées ne sont pas récupérées à travers le checkbox.

ci-dessous mon code source de la consultation générale avec checkbox :
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
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
 
			// Consultation Generale
 
          if (isset($_POST['Valider']))
	           {
			      $Choix  = $_POST['Choix'];
                  //echo $Choix;
			      if ($Choix == 'Generale')
	                 {
 
			      echo '<table><tr>
				<th> RAM </th>
				<th> ID </th>
				<th>DATE </th>
				<th>PROJETS / TÂCHES</th>
				<th>DESCRIPTION</th>
				<th>ETAT D’AVANCEMENT	</th>
				<th>RESPONSABLE </th>
				<th>ETAT </th>
				<th>MODIFIER</th>
				<th>SUPPRIMER</th>
				</tr>';
 
			try
			{
 
 
		$date1 = $_POST['date1'];
		$date2 = $_POST['date2'];
			 $reponse = $bdd->query("SELECT 
	 a.id_rah,
     a.datejour,
	 a.projets_taches,
	 a.description,
	 a.avancement,
	 a.entite_responsable,
	 a.etat_tache
     FROM 
     rah a
	 where datejour between '$date1' and '$date2' order by a.datejour");
 
			while ($donnees = $reponse->fetch())
			{
				$i++;
				echo '<tr>';
					echo '
 
					<td><input type="checkbox" name="checkbox[]" id ="checkbox" value ="<?php echo '.$donnees['id_rah'].'?>" /></td>
					<td>'. $donnees['id_rah'].'</td>
					<td>'. $donnees['datejour'].'</td>
					<td>'. $donnees['projets_taches'].'</td>
					<td>'. $donnees['description'].'</td>
					<td>'. $donnees['avancement'].'</td>
					<td>'. $donnees['entite_responsable'].'</td>
					<td>'. $donnees['etat_tache'].'</td>';
					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
				echo '</tr>';
 
			}
 
			}
			catch(Exception $e)
            {
                 die('Erreur : '.$e->getMessage());
            }
 
			   }
 
 
			   echo '</table>';
J'ai fait un et il me renvoie la valeur NULL.

ci-dessous mon code source pour affichage du deuxième tableau :

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
42
43
44
45
 
var_dump($_POST['checkbox']);
			   if (isset($_POST['checkbox']))
               { 
			     $checkbox = $_POST['checkbox'];
			     echo '<table><tr>
				<th>DATE </th>
				<th>PROJETS / TÂCHES</th>
				<th>DESCRIPTION</th>
				<th>ETAT D’AVANCEMENT	</th>
				<th>RESPONSABLE </th>
				<th>ETAT </th>
				</tr>';
 
				//recupérer ces valeurs dans un array
                 $tabCheckbox = ($_POST['checkbox']);
                 foreach ($tabCheckbox as $checkbox) 
				 {
                 $checkbox[] = addslashes($checkbox);
                 $reponse = $bdd->query("SELECT 
	             a.id_rah,
				 a.datejour,
				 a.projets_taches,
				 a.description,
				 a.avancement,
				 a.entite_responsable,
				 a.etat_tache
				 FROM 
				 rah a 
				 where a.datejour = '$checkbox' order by a.datejour");
 
				$donnees = $reponse->fetch();
				$i++;
				echo '<tr>';
					echo '
					<td>'. $donnees['datejour'].'</td>
					<td>'. $donnees['projets_taches'].'</td>
					<td>'. $donnees['description'].'</td>
					<td>'. $donnees['avancement'].'</td>
					<td>'. $donnees['entite_responsable'].'</td>
					<td>'. $donnees['etat_tache'].'</td>';
				echo '</tr>';
				}
 
               }
Comme je l'ai dit plus haut le var_dump($_POST['checkbox']); me renvoie un résultat NULL et donc la requête du deuxième code ne renvoie rien.


Alors je veux savoir si j'affiche bien mon id-rah ?

merci pour vos reponses.