Problème d'insertion des données dans ma base de données en php

Bades Messages postés 2 Date d'inscription jeudi 5 juillet 2007 Statut Membre Dernière intervention 15 août 2011 - 15 août 2011 à 11:08
Mickael33480 Messages postés 34 Date d'inscription mardi 29 avril 2008 Statut Membre Dernière intervention 16 août 2011 - 15 août 2011 à 14:46
salut à tous,
je suis en train de réaliser un formulaire en php ,mon formulaire est relié à une Base de données. Mon problème, quand je rempli le formulaire,les enregistrements ne sont pas pris en compte dans la base de donnée. si quelqu'un pouvait me donner un coup de main. voici mes différents formulaires

fichesaisie.php

,
SAISIE DES NOTES DE L'ELEVE

----

Matieres Spécifiques |
1er Trimestre |

2ème Trimestre |

3ème Trimestree |

Moyenne Anuelle |

----

,
,
,
,
,

----

,
,
,
,
,

----

,
,
,
,
,

----

,
,
,
,
,

----

,
,
,
,
,

----

,
,
,
,
,

----

,
,
,
,
,

----
AUTRES INFORMATION,
----

Résultat

Admis(e)
refusé
, Sélectionnez un élément. Handicap


Métier
,
Sélectionnez un élément. Handicap,

----

double selection

technique
general
,
Résidence des parent
,
Personne prise en charge

Parent
Tuteur
,
Contact






VOEUX D'ORIENTATION DE L'ELEVE ,
----

FILIERES(Entrée le code de la filière),
ETABLISSEMENTS (Entrée le code de l'établissement),

----

,
,
1er Etablissement,

----

,
2ème Etablissement,

----

,
2ème Etablissement









voici le formulaire serveur
serv_fichesaisie.php


2 réponses

cod57 Messages postés 1653 Date d'inscription dimanche 7 septembre 2008 Statut Membre Dernière intervention 11 septembre 2013 19
15 août 2011 à 12:10
bonjour
tu devalides requires_once
et une erreur
Notice: Undefined variable: count in C:\wamp\www\romain\bades\serv_fichesaisie.php on line 73
Fatal error: Function name must be a string in C:\wamp\www\romain\bades\serv_fichesaisie.php on line 73


cette variable n'existe pas pas mais
fait ex

//$count($matiere)
for($u=0;$u < 7;$u++)

tu mets des echo devant tes requetes et tu veras un peu plus clair
<?php
echo '';
print_r($_POST);

session_start();
//require_once('connexion.php');
?> 

tu fais un extract qui sert a rien il me semble ...
<?php 
mysql_select_db($database_dbprotect, $dbprotect); 

if ((isset($_POST['validation'])) && $_POST['validation'] == "valider") { 

echo ""; 
print_r($_POST); 
echo "

"; 

extract($_POST); 


//$francais=addslashes($_POST["francais"]); 
$notfranc1 = addslashes($_POST["notfranc1"]); 
$notfranc2 = addslashes($_POST["notfranc2"]); 
$notfranc3 = addslashes($_POST["notfranc3"]); 
$notfranc4 = addslashes($_POST["notfranc4"]); 

//$math=addslashes($_POST["math"]); 
$notmath1 = addslashes($_POST["notmath1"]); 
$notmath2 = addslashes($_POST["notmath2"]); 
$notmath3 = addslashes($_POST["notmath3"]); 
$notmath4 = addslashes($_POST["notmath4"]); 

//$anglais=addslashes($_POST["anglais"]); 
$notanglais1 = addslashes($_POST["notanglais1"]); 
$notanglais2 = addslashes($_POST["notanglais2"]); 
$notanglais3 = addslashes($_POST["notanglais3"]); 
$notanglais4 = addslashes($_POST["notanglais4"]); 

//$scphys=addslashes($_POST["scphys"]); 
$notphys1 = addslashes($_POST["notphys1"]); 
$notphys2 = addslashes($_POST["notphys2"]); 
$notphys3 = addslashes($_POST["notphys3"]); 
$notphys4 = addslashes($_POST["notphys4"]); 

//$ortho=addslashes($_POST["ortho"]); 
$notortho1 = addslashes($_POST["notortho1"]); 
$notortho2 = addslashes($_POST["notortho2"]); 
$notortho3 = addslashes($_POST["notortho3"]); 
$notortho4 = addslashes($_POST["notortho4"]); 

//$histgeo=addslashes($_POST["histgeo"]); 
$histgeo1 = addslashes($_POST["histgeo1"]); 
$histgeo2 = addslashes($_POST["histgeo2"]); 
$histgeo3 = addslashes($_POST["histgeo3"]); 
$histgeo4 = addslashes($_POST["histgeo4"]); 

//$svt=addslashes($_POST["svt"]); 
$notsvt1 = addslashes($_POST["notsvt1"]); 
$notsvt2 = addslashes($_POST["notsvt2"]); 
$notsvt3 = addslashes($_POST["notsvt3"]); 
$notsvt4 = addslashes($_POST["notsvt4"]); 

$ResultatExamenCand = addslashes($_POST["ResultatExamenCand"]); 
$metier = addslashes($_POST["metier"]); 
$HandicapCand = addslashes($_POST["HandicapCand"]); 
$DoubleSelectCand = addslashes($_POST["DoubleSelectCand"]); 
$residenceParentCand = addslashes($_POST["residenceParentCand"]); 
$PersoneEnChargeCand = addslashes($_POST["PersoneEnChargeCand"]); 
$CelCand = addslashes($_POST["CelCand"]); 

$validation = array(); 
  //$count($matiere)
for($u=0;$u < $count($matiere);$u++) 

{ 

$matiere = $matiere[$u]; 


echo $requete = "INSERT INTO note (trimestre1 , trimestre2, trimestre3,moyenannuel)VALUES ('',"; 
switch ($matiere) { 
case "FRANCAIS": 

$parametres = $notfranc1."', '".$notfranc2."', '".$notfranc3."', '".$notfranc4."'"; 
break; 

case "MATHEMATIQUES": 

$parametres = $notmath1."', '".$notmath2."', '".$notmath3."', '".$notmath4."'"; 
break; 

case "ANGLAIS": 

$parametres = $notanglais1."', '".$notanglais2."', '".$notanglais3."', '".$notanglais4."'"; 
break; 

case "SCIENCES PHYSIQUES": 

$parametres = $notphys1."', '".$notphys2."', '".$notphys3."', '".$notphys4."'"; 
break; 

case "ORTHOGRAPHE": 

$parametres = $notortho1."', '".$notortho2."', '".$notortho3."', '".$notortho4."'"; 
break; 

case "HISTOIRE GEOGRAPHIE": 

$parametres = $histgeo1."', '".$histgeo2."', '".$histgeo3."', '".$histgeo4."'"; 
break; 

case "SVT": 

$parametres = $notsvt1."', '".$notsvt2."', '".$notsvt3."', '".$notsvt4."'"; 
break; 

} 

echo $tableau[1] = $requete .= $parametres.'")";'; 

echo $tableau[2] = $requete_info = "INSERT INTO candidat (ResultatExamenCand,metier,Handicap,DoubleSelectCand,residenceParentCand,PersoneEnChargeCand,CelCand )
VALUES (
'',
'$ResultatExamenCand',
'$metier',
'$Handicap',
'$DoubleSelectCand',
'$residenceParentCand',
'$PersoneEnChargeCand',
'$CelCand')"; 


function validiter_execution($requete_a_executer) 
{ 
return (mysql_query($requete_a_executer)) ? true : false; 
} 


$statut_execution_requete = ""; 
for($i=0;$i< count($tableau);$i++) 
{ 
$statut_execution_requete = validiter_execution($tableau[$i]); 
} 

$validation[$u] = $statut_execution_requete; 

} 

// if (in_array(false, $validation)) // validation a tester 
// 
// { 
// echo "l'inscription a ŽchouŽe
"; 
// } 
// else 
// { 
// echo "l'inscription a été effectuée avec succès
"; 
// } 

echo "l'inscription a été effectuée avec succès
"; 
echo "Nouvelle inscription"; 
echo "
Consulter la liste"; 
} 
?> 


Bonne programmation !
0
Mickael33480 Messages postés 34 Date d'inscription mardi 29 avril 2008 Statut Membre Dernière intervention 16 août 2011 2
15 août 2011 à 14:46
Salut Bades,

Essaye d'ajouter un
<? or die('Erreur SQL !'.$sql.mysql_error()) ?>
à la fin des tes requête SQL pour avoir les erreurs SQL qui remontes. Si tu en as, donne les ici.

<? $req1 = mysql_query($sql1) or die('Erreur SQL !'.$sql.mysql_error()); ?>
0
Rejoignez-nous