Bonjour,

voila je voudrais cacher un tableau quand une variable est vide pour afficher qu'il y a rien dedans


ex:quand le panier est plein le tableau apparait avec les description de l'article,par contre s'il est vide le tableau disparait au profit d'un "votre panier est vide"

je suis pas trés fort avec les boucles

je précise que le code que je vais vous mettre viens d'un tuto du forum
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
 
<table>
 
 
 
		<th class="nom">nom de l'article</th>
		<th class="quantite">Quantité</th>
		<th class="prix">Prix Unitaire</th>
		<th class="action">Action</th>
		<th class="total">total</th>
 
 
 
 
 
      </tr>
 
   </thead>
 
   <tbody>
 
	<?php
	if (creationPanier())
	{
	   echo'<center>';$nbArticles=count($_SESSION['panier']['nom']);
	   echo'</center>';
	   if ($nbArticles <= 0)
	   echo "<tr><td>Votre panier est vide </ td></tr>";
	   else
	   {
	      for ($i=0 ;$i < $nbArticles ; $i++)
	      {
 
	         echo "<td>".htmlspecialchars($_SESSION['panier']['nom'][$i])."</ td>";
	         echo "<td><input type=\"text\" size=\"4\" name=\"q[]\" value=\"".htmlspecialchars($_SESSION['panier']['quantite'][$i])."\"/></center></td>";
	         echo "<td>".htmlspecialchars($_SESSION['panier']['prix'][$i])."€</td>"; 
	         echo "<td><a href=\"".htmlspecialchars("../tests/commander.php?action=suppression&l=".rawurlencode($_SESSION['panier']['nom'][$i]))."\">supprimer</a></td>"; 
 
	      }
 
 
	      echo "<td>";echo "Total : ".MontantGlobal();echo "€</td></tr>";
 
 
	      echo "</td></tr>";
	   }
	}
	?>
 
</table>

merci pour votre aide