Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD
PHP & SGBD Forum d'entraide sur les SGBD avec PHP. Avant de poster : FAQ BDD, toutes les FAQ PHP, cours BDD et sources BDD
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 02/10/2011, 14h51   #1
Invité de passage
 
Inscription : août 2009
Messages : 13
Détails du profil
Informations forums :
Inscription : août 2009
Messages : 13
Points : 1
Points : 1
Par défaut erreur dans mon code PHP

salut à tous je suis débutant en PHP . je suis entreint de concevoir un code PHP et voila que je suis bloqué. alors je suis la pour solliciter votre aide .
voici l'erreur que je reçois :
Citation:
Notice: Undefined index: autrepiece in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 20

Notice: Undefined index: nomRegion in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 27

Notice: Undefined index: nomDepartement in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 28

Notice: Undefined index: vaccinBCG in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 39

Notice: Undefined index: vaccinPOLIO in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 40

Notice: Undefined index: vaccinFIEVRE in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 41

Notice: Undefined index: vaccinROUGEOLE in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 42

Notice: Undefined variable: result in C:\wamp\www\IDENTIFICATION\ESSAI fiche d'identification ministere ex-Combattants.php on line 71
Code :
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
$date = date("d-m-Y");
$heure = date("H:i");
echo 'Nous sommes le '.$date.' et il est '.$heure;
?>
<?php
if (isset($_POST["valider"])) {
    $matricule=trim($_POST["matricule"]);
    $nom=trim($_POST["nom"]);
	$prenom=trim($_POST["prenom"]);
	$datnaiss=trim($_POST["datnaiss"]);
	$lieunaiss=trim($_POST["lieunaiss"]);
	$nationalite=trim($_POST["nationalite"]);
	$ethnie=trim($_POST["ethnie"]);
	$sexe=trim($_POST["sexe"]);
	$situation=trim($_POST["situation"]);
	$religion=trim($_POST["religion"]);
	$piece=trim($_POST["piece"]);
	$npiece=trim($_POST["npiece"]);
	$autrepiece=trim($_POST["autrepiece"]);
	$nompere=trim($_POST["nompere"]);
	$prenompere=trim($_POST["prenompere"]);
	$nommere=trim($_POST["nommere"]);
	$prenommere=trim($_POST["prenommere"]);
	$tel=trim($_POST["tel"]);
	$cel=trim($_POST["cel"]);
	$nomRegion=trim($_POST["nomRegion"]);
	$nomDepartement=trim($_POST["nomDepartement"]);
	$nomSousprefecture=trim($_POST["nomSousprefecture"]);
	$nomVillage=trim($_POST["nomVillage"]);
	$nomZone=trim($_POST["nomZone"]);
	$nomEmployeur=trim($_POST["nomEmployeur"]);
	$prenomEmployeur=trim($_POST["prenomEmployeur"]);
	$prenomConjoint=trim($_POST["nomConjoint"]);
	$nomEnfant=trim($_POST["nomEnfant"]);
	$prenomEnfant=trim($_POST["prenomEnfant"]);
	$nomAgent=trim($_POST["nomAgent"]);
	$prenomAgent=trim($_POST["prenomAgent"]);
	$vaccinBCG=trim($_POST["vaccinBCG"]);
	$vaccinPOLIO=trim($_POST["vaccinPOLIO"]);
	$vaccinFIEVRE=trim($_POST["vaccinFIEVRE"]);
	$vaccinROUGEOLE=trim($_POST["vaccinROUGEOLE"]);
	$type=trim($_POST["type"]);
	$nomZone=trim($_POST["nomZone"]);
	$nomTuteur=trim($_POST["nomTuteur"]);
 
	if (empty($matricule) || empty($nom)|| empty($prenom)) {
		$msg="<font color=red>Veuillez saisir votre matricule et votre nom et prenom !!!!!!!!!</font>";
 
			mysql_connect("localhost","root","") or die("erreur de connexion");
			mysql_select_db("la_base_du_ministere") or die("Erreur de selection de la BD");
			// on insert les données
 
			$sql1="INSERT INTO eleve(matricule,nom,prenom,datnaiss,lieunaiss,nationalite,ethnie,sexe,situation,religion,piece,npiece,autrepiece,nompere,prenompere,nommere,prenommere,tel,cel) 
values('".$matricule."','".$nom."','".$prenom."','".$datnaiss."','".$lieunaiss."','".$nationalite."','".$ethnie."','".$sexe."','".$situation."','".$religion."','".$piece."','".$npiece."','".$autrepiece."','".$nompere."','".$prenompere."','".$nommere."','".$prenommere."','".$tel."','".$cel."')";
$sql2="INSERT INTO region(nomRegion) values('".$nomRegion."')";
$sql3="INSERT INTO departemnt(nomDepartement) values('".$nomDepartement."')";
$sql4="INSERT INTO sousprefecture(nomSousprefecture) values('".$nomSousprefecture."')";
$sql5="INSERT INTO village(nomVillage) values('".$nomVillage."')";
$sql6="INSERT INTO zone(nomZone) values('".$nomZone."')";
$sql7="INSERT INTO employeur(nomEmployeur,prenomEmployeur) values('".$nomEmployeur."','".$prenomEmployeur."')";
$sql8="INSERT INTO conjont(nomConjoint,prenomConjoint) values('".$nomConjoint."','".$prenomConjoint."')";
$sql9="INSERT INTO enfant(nomEnfant,prenomEnfant) values('".$nomEnfant."','".$prenomEnfant."')";
$sql10="INSERT INTO agent(nomAgent,prenomAgent) values('".$nomAgent."','".$prenomAgent."')";
$sql11="INSERT INTO vaccin(vaccinBCG,vaccinPOLIO,vaccinFIEVRE,vaccinROUGEOLE) values('".$vaccinBCG."','".$vaccinPOLIO."','".$vaccinFIEVRE."','".$vaccinROUGEOLE."')";
$sql12="INSERT INTO activite(type) values('".$type."')";
$sql13="INSERT INTO zone(nomZone) values('".$nomZone."')";
$sql14="INSERT INTO tuteur(nomTuteur,prenomTuteur) values('".$nomTuteur."','".$prenomTuteur."')";
 
			$result=mysql_query($sql1,$sql2,$sql3,$sql4,$sql5,$sql6,$sql7,$sql8,$sq99,$sql10,$sql11,$sql12,$sql13,$sql14);  }
		if ($result) {
			$msg="<font color=green>insertion OK</font>";
		}
		else {
			$msg="<font color=red>insertion impossible</font>";
		}
 
 
}
 
?>
msi79 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/10/2011, 17h05   #2
Futur Membre du Club
 
Inscription : juillet 2009
Messages : 18
Détails du profil
Informations forums :
Inscription : juillet 2009
Messages : 18
Points : 19
Points : 19
Salut,

Le message d'erreur t'indiques que l'index (clé tableau) n'existe pas pour "...".

Pour checker ce que tu as dans ton tableau "$_POST" fais :
Ou
Tassin73 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/10/2011, 14h47   #3
Modératrice
 
Avatar de Celira
 
Femme
Développeuse PHP/Java
Inscription : avril 2007
Messages : 3 661
Détails du profil
Informations personnelles :
Sexe : Femme
Âge : 27
Localisation : France

Informations professionnelles :
Activité : Développeuse PHP/Java

Informations forums :
Inscription : avril 2007
Messages : 3 661
Points : 5 388
Points : 5 388
Au passage, mettre des espaces dans le nom d'un fichier php n'est pas une bonne idée. D'une façon générale, évite tous les caractères spéciaux, caractères accentués, espaces, et fais attention à la casse majuscules/minuscules. Ce n'est pas parce que tu développes en local sur une machine Windows que ce sera le cas du serveur de ton hébergeur.

Donc au lieu de ESSAI fiche d'identification ministere ex-Combattants.php, quelque chose comme essai_fiche_identification_ministere_ex-combattants.php évitera un certain nombre de problèmes.
__________________
Modératrice PHP
Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)

Pour afficher votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur)
Celira est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 03h56.


 
 
 
 
Partenaires

Hébergement Web