Erreur php

Bonjour,

Voici mon code :

<?php include("login.php"); $connexion=mysql_connect("$db_host","$db_log","$db_pwd"); mysql_select_db($db_name) or die ("problème de connexion"); $code = $_POST['code']; $designation = $_POST['designation']; $type = $_POST['type']; $couleur = $_POST['couleur']; $taille = $_POST['taille']; $prix = $_POST['prix']; $qte = $_POST['qte']; if(isset($_POST['valider'])) { $sql= "INSERT INTO ansf_articles(art_code,art_designation,art_type,art_couleur,art_taille,art_prix,art_qte) VALUES ('$code','$designation','$type','$couleur','$taille','$prix','$qte')"; $req= "UPDATE ansf_articles SET art_valeur = art_prix * art_qte WHERE art_code=".$code.""; mysql_query($sql); mysql_query($req); mysql_close($connexion); echo 'Article créé'; } if(isset($_POST['new'])) { echo ' Nouvel Ajout'; } ?>
	<div id="corp">
		<div id="haut">
		<table width="100%" height="100%"><tr><td id="image" height="100%" width="100%"></td></tr></table>
		</div>
		
		<div id="menu_gauche"><br/>
			<span id="accueil" onMouseOver="affichage('accueil');" onMouseOut="affichage2('accueil');"><a href="../accueil.php">Accueil</a></span><br/><br/>
			<span id="creer" onMouseOver="affichage('creer');" onMouseOut="affichage2('creer');"><a href="php/creation_art.php">Créer un article</a></span><br/><br/>
			<span id="vente" onMouseOver="affichage('vente');" onMouseOut="affichage2('vente');"><a href="php/vente_art.php">Ventes d'aricle</a></span><br/><br/>
			<span id="achat" onMouseOver="affichage('achat');" onMouseOut="affichage2('achat');"><a href="php/achat_art.php">achats fournisseurs</a></span><br/><br/>
			<span id="stock" onMouseOver="affichage('stock');" onMouseOut="affichage2('stock');"><a href="php/stockmanif.php">Stock Manifestation</a></span><br/><br/>
			<span id="fiche" onMouseOver="affichage('fiche');" onMouseOut="affichage2('fiche');"><a href="php/stock.php">Fiche de stock</a></span><br/><br/>
			<span id="client" onMouseOver="affichage('client');" onMouseOut="affichage2('client');"><a href="php/clients.php">Liste des clients</a></span><br/><br/>
			<span id="fourn" onMouseOver="affichage('fourn');" onMouseOut="affichage2('fourn');"><a href="">Liste des fournisseurs</a></span>
		</div>
		<div id="centre">
			<FORM method="post" action="' .$_SERVER['PHP_SELF']. '">
			 <FIELDSET>
				<LEGEND align=top> <b>Créer un article</b> </LEGEND><br>
					<u>Code</u> : <INPUT name="code" type="text" size="40"> 
					<u>Designation</u> : <INPUT name="designation" type="text" size="40"><br><br>
					<u>Type</u> : <SELECT name="type">
										<OPTION VALUE="manches courtes">Manches courtes </OPTION>
										<OPTION VALUE="manches longues">Manches longues</OPTION>
								 </SELECT> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<u>Couleur</u> : <SELECT name="couleur">
										<OPTION VALUE="bleu marine">Bleu marine</OPTION>
										<OPTION VALUE="blanc">Blanc</OPTION>
								 </SELECT><br><br>
					<u>Taille</u> : <SELECT name="taille">
									<OPTION VALUE="S">S</OPTION>
									<OPTION VALUE="M">M</OPTION>
									<OPTION VALUE="L">L</OPTION>
									<OPTION VALUE="XL">XL</OPTION>
									<OPTION VALUE="XXL">XXL</OPTION>
									<OPTION VALUE="XXXL">XXXL</OPTION>
							 </SELECT> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<u>Prix</u> : <INPUT name="prix" type="text" size="40">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<u>Quantit&eacute;</u> : <INPUT name="qte" type="text" size="40"><br><br>
					
					<input type="submit" name="valider" value="Ajouter" />
					<input type="submit" name="new" value="Nouveau" /><br/><br/>	
			 </FIELDSET>
			</FORM>
		</div>
	</div>
--------------------------------------------------------------------------------------------------------------------------------------------

Voici mes erreurs :

Notice: Undefined index: code in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 16

Notice: Undefined index: designation in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 17

Notice: Undefined index: type in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 18

Notice: Undefined index: couleur in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 19

Notice: Undefined index: taille in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 20

Notice: Undefined index: prix in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 21

Notice: Undefined index: qte in C:\Program Files\EasyPHP5.3.0\www\ANSF\php\creation_art.php on line 22

Pourtant je ne comprend pas, car ce sont bien les noms des inputs, donc je ne vois pas pourquoi j’ai une erreur.
Quant aux requetes, lorsque je les test, elles fonctionnent ( cet erreur ne vient pas que sur cet page );
Je précis que dans les inputs en readonly, je veux faire apparaitre le resultat d’une requete par rapport au code saisie.

Cela fait maitenant depuis hier matin que je cherche mon erreur, et je ne comprend toujours pas…

Si quelqu’un peut m’aider, ça serait assez sympas :slight_smile:

[:paysan] je vois pas trop le rapport avec Windows.

Direction Programmation.
Edité le 21/05/2010 à 13:06

Parce que ce n’est initialisé que si tu postes le formulaire…

Le forum clubic c’est de la … il y a même pas les petits numéro de ligne à coté du code :frowning:
Edité le 21/05/2010 à 14:14

@Sans-Nom

Comment ça ?
Edité le 21/05/2010 à 14:49

j’ai trouvé, désole du message inutile .

mes variables étaient placés au chargement de la page,or il fallait les placés dans le isset
Edité le 21/05/2010 à 15:23