Besoin D'aide SVP...ERREURS EN PHP

Fermé
Lusitano25 Messages postés 3 Date d'inscription mercredi 19 mai 2010 Statut Membre Dernière intervention 21 mai 2010 - 21 mai 2010 à 11:01
hack_net Messages postés 783 Date d'inscription lundi 5 mars 2007 Statut Membre Dernière intervention 5 juin 2014 - 21 mai 2010 à 11:19
Bonjour,

Voici mon code :
----------------------------------------------------------------------
<!-- CREATION DES ARTICLES -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/style.css">
<img src="../images/header.jpg">
<script language="javascript" src="script/script.js"></script>
<script language="javascript" src="script/mootools-1.2.4-core-jm.js"></script>
</head>

<?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 '<img src="../images/validation.jpg">Article créé';
}

if(isset($_POST['new']))
{
echo '<img src="../images/new.jpg"> Nouvel Ajout';
}

?>
<body>

<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>      
<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>                
<u>Prix</u> : <INPUT name="prix" type="text" size="40">          
<u>Quantité</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>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------

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...

(Veuillez exuser ma longueur de texte )

Si quelqu'un peut m'aider, ça serait assez sympas :)
A voir également:

1 réponse

hack_net Messages postés 783 Date d'inscription lundi 5 mars 2007 Statut Membre Dernière intervention 5 juin 2014 51
21 mai 2010 à 11:19
Pas la peine de faire un double post...
0