je vous explique ma situation. J'ai une table catégorie qui contient :
-idCategorie
-nomCategorie
-nomSousCategorie
j'ai créer un formulaire ajout de categorie, il marche très bien. J'ai voulu créer un formulaire "ajout de sous categorie" il ne marche pas.
Voici l'erreur :
Voici mon code :Notice: Undefined variable: idCategorie in c:\jennifer\easyphp1-8\www\aadena.net\extranet\insertsouscategorie.php on line 8
Problème lors de l'enregistrement
INSERT INTO categorie (nomSousCategorie) values ('bouh') where idCategorie=''
<?php
//require("include/secure.php");
//require("include/comvar.php");
include_once("include/secure.php");
include_once("include/comvar.php");
if (isset($submit)){
$sql ="INSERT INTO categorie (nomSousCategorie) values ('$nomSousCategorie') where idCategorie='$idCategorie'";
//$sql ="UPDATE categorie SET nomSousCategorie='$nomSousCategorie' WHERE idCategorie='$idCategorie'";
if ($result = mysql_query($sql)) {
header("Location:adminCategorie.php");
}
else {
echo "<BR>Problème lors de l'enregistrement<BR><BR>";
echo $sql;
}
}
?>
<html>
<head>
<link href="CSS/ADENA1.css" rel="stylesheet" type="text/css">
<link href="CSS/ADENA3.css" rel="stylesheet" type="text/css">
<link href="CSS/Nouveau%20dossier.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" bgcolor="#FFFFFF">
<table width="101%" height="74" border="0" cellpadding="0" cellspacing="0" class="ADENA4">
<tr>
<td width="18%" height="74" class="TITRE"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="186" height="74">
<param name=movie value="images/adena.swf">
<param name=quality value=high>
<embed src="images/adena.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="186" height="74">
</embed> </object> </td>
<td width="82%" class="TITRE"><b>Insertion
d'une nouvelle sous categorie</b><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"> </font></td>
</tr>
</table><br>
<table width="973" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="1255" height="30" align="center" valign="middle" class="ggg"><a href="index.php" class="ggg">Menu
Général</a> </td>
</tr>
</table>
<center>
<BR>
</center>
<form method="post" action="<?php echo "$PHP_SELF"?>">
<table width="900" border="0" cellspacing="0" cellpadding="0" background="" align="center">
<tr>
<td> </td>
<td width="900" colspan="2"> <table width="100%" border="1" cellspacing="0">
<!--<tr>
<td width="300" align="center" bgcolor="#81ADC8" class="ADENA5"><b><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="2">Categorie</font></b></td>
<td bgcolor="#FFFFFF" align="left" width="300"> <div align="left"><font color="#FFFFFF" size="2"><b><font face="Arial, Helvetica, sans-serif">
<input type="text" size="50" name="nomCategorie">
</font></b></font></div></td>
</tr>-->
<tr>
<td width="300" align="center" bgcolor="#81ADC8" class="ADENA5"><b><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="2">Sous Categorie</font></b></td>
<td bgcolor="#FFFFFF" align="left" width="300"> <div align="left"><font color="#FFFFFF" size="2"><b><font face="Arial, Helvetica, sans-serif">
<input type="text" size="50" name="nomSousCategorie">
</font></b></font></div></td>
</tr>
<tr bgcolor="#669ACC">
<td colspan="2" align="center"> <font color="#FFFFFF" size="2"><b><font face="Arial, Helvetica, sans-serif">
<input type="submit" name="submit" value="Valider">
</font></b></font><font size="2"> </font></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="20" bgcolor="#669ACC" > <div align="center" class="ADENA"><font size="2"><b><a href="../index.php" class="ADENA">Direction
site public</a></b></font></div></td>
<td height="20" bgcolor="#669ACC" > <div align="center" class="ADENA"><font size="2"><b><a href="index.php" class="ADENA">Direction
panneau d'Administration</a></b></font></div></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
Merci d'avance de votre aide. N'hésité pas a me demander plus de renseignement.Jenny