je ne comprend pas cette erreur (ci desous) ou alors quelle erreur est ce que je fais au niveau du else{}
PHP Notice: Undefined variable: idCat in C:\\xampp\\htdocs\\kant\\produits.php on line 127, referer: http://localhost/kantt/index.php?panier=1
<?php
require_once("connection.php");
if (isset($_POST["motCle"])){
$motCle = $_POST["motCle"];
$req = $dbConnect->query("SELECT * FROM produit WHERE designation LIKE '%$motCle%'");
}
elseif (isset($_GET["idCat"])) {
$idCat = $_GET["idCat"];
$req = $dbConnect->query("SELECT * FROM produit WHERE code_cat='$idCat'");
}
else{
$req = $dbConnect->query("SELECT * FROM produit");
}
?>
<div id="produits">
<?php
while($prod=$req->fetch(PDO::FETCH_ASSOC)) {
?>
<div id="produit" align="center">
<form method="post" action="formular.php">
<table>
<td><a>Pos.Nr. / Kantt-Nr.</a></td>
<td><input type="text" name="postnr_kanttnr" size="60" required="required"></td>
</tr>
<tr>
<td><a>Bezeichnung:</a></td>
<td><input type="text" name="bezeichnung" size="60" required="required"></td>
</tr>
<tr>
<td><a>Farbe:</a></td>
<td><input type="text" name="farbe" size="60" required="required"></td>
</tr>
<tr>
<td><a>Anzahl x Länge:</a></td>
<td><input type="text" name="anzahl_laenge" size="60" required="required"></td>
</tr>
<tr>
<td><a>Bemerkung:</a></td>
<td><input type="text" name="bemerkung" size="60" required="required"></td>
</tr>
<tr>
<td></td>
<td rowspan="1" align="center"><img src="images/<?php echo $prod['photo']?>"></td>
</tr>
<tr>
<td><h3>Designation:</h3></td><td width="100px"><h3><?php echo $prod['DESIGNATION']?></h3></td>
</tr>
<tr>
<td><a>a</a><input type="text" name="a" size="4" required="required" ></td>
<td><a>b</a><input type="text" name="b" size="4" required="required"></td>
</tr>
<tr>
<td><a>c</a><input type="text" name="c" size="4" required="required"></td>
<td><a>d</a><input type="text" name="d" size="4" required="required"></td>
</tr>
<tr>
<td><a>e</a><input type="text" name="e" size="4" required="required"></td>
<td><a>f </a><input type="text" name="f" size="4" required="required"></td>
</tr>
<tr>
<td><a>g</a><input type="text" name="g" size="4" required="required"></td>
<td><a>α</a><input type="text" name="alpha" size="4" required="required"></td>
</tr>
<tr>
<td colspan="4" align="right">
<div id="formPanier">
<form method="post" action="addCaddie.php" id="form2">
<input type="text" name="quantite" size="4" value="1"/>
<input type="hidden" name="designation" value="<?php echo $prod['DESIGNATION']; ?>" />
<input type="image" src="images/korb.jpg" value="submit" align="right"/>
</tr>
</form>
</div>
<input type="hidden" name="idCat" value="<?php echo $idCat; ?>"> //c'est ici la ligne 127
</td>
</tr>
<tr>
<td></td><td align="right"><br><input type="submit" name="produit_erstellen" value="Speichern"></td>
</tr>
</table>
</form>
</div>
<?php
}
?>
</div>