Script php pour un formulaire
Fermé
dixijw
-
9 févr. 2009 à 18:41
974_Vin's_974 Messages postés 547 Date d'inscription vendredi 23 janvier 2009 Statut Membre Dernière intervention 19 février 2009 - 12 févr. 2009 à 10:16
974_Vin's_974 Messages postés 547 Date d'inscription vendredi 23 janvier 2009 Statut Membre Dernière intervention 19 février 2009 - 12 févr. 2009 à 10:16
A voir également:
- Script php pour un formulaire
- Script vidéo youtube - Guide
- Formulaire de réclamation facebook - Guide
- Easy php - Télécharger - Divers Web & Internet
- Formulaire instagram compte suspendu - Guide
- Le formulaire rempli - Guide
12 réponses
atspinto
Messages postés
338
Date d'inscription
samedi 30 août 2008
Statut
Membre
Dernière intervention
8 août 2014
27
9 févr. 2009 à 18:50
9 févr. 2009 à 18:50
slut...
La condition AND non non non..
c'est plutot un and que tu dois utiliser...
Si t'avais un bon editeur tu l'aurais remarké
Fais le .. et ça marchera...
La condition AND non non non..
c'est plutot un and que tu dois utiliser...
Si t'avais un bon editeur tu l'aurais remarké
Fais le .. et ça marchera...
merci mon gar mais g tente encore mais depuis la je sui confronter a des problemes de syntaxe je ne sai plus comment m'ensortir et en plus tu m'aide bocou ok
niahoo
Messages postés
247
Date d'inscription
lundi 24 décembre 2007
Statut
Membre
Dernière intervention
23 mai 2010
19
10 févr. 2009 à 10:01
10 févr. 2009 à 10:01
/* fin du premier volet de la partie 1 tout dabord, on va donner les intructions a mysql pour la base de donnée connection a la base de donnée */ if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol'])) { mysql_connect("localhost","root",""); mysql_select_db("bd_inscription"); }
AND and And aND c'est pareil la casse ne change rien..
essaye comme ça plutôt, il ne faut pas sauter des lignes entre es conditons de ton "if" et l'accolade ouvrante, mais l'erreur vient surtout du fait que tu n'a aps refermé la parenthese if()
Ceika
Messages postés
52
Date d'inscription
mercredi 13 décembre 2006
Statut
Membre
Dernière intervention
15 décembre 2009
13
10 févr. 2009 à 10:02
10 févr. 2009 à 10:02
// partie 1 . Ici l'on va creer les differentes variables mmais il faut rappeller que l'on prend les données dans un formulaire
if (isset($_POST['nom'])AND
isset($_POST['prenom'])AND
isset($_POST['email'])AND
isset($_POST['dat_nais'])AND
isset($_POST['lieu'])AND
isset($_POST['sexe'])AND
isset($_POST['nationalite'])AND
isset($_POST['ref_pere'])AND
isset($_POST['ref_mere'])AND
isset($_POST['adresse'])AND
isset($_POST['etablissement'])AND
isset($_POST['nivo_etud'])AND
isset($_POST['clas_preced'])AND
isset($_POST['annee_scol']) // ici tu as oublié de fermer ton if avec une parenthèse fermente )
if (isset($_POST['nom'])AND
isset($_POST['prenom'])AND
isset($_POST['email'])AND
isset($_POST['dat_nais'])AND
isset($_POST['lieu'])AND
isset($_POST['sexe'])AND
isset($_POST['nationalite'])AND
isset($_POST['ref_pere'])AND
isset($_POST['ref_mere'])AND
isset($_POST['adresse'])AND
isset($_POST['etablissement'])AND
isset($_POST['nivo_etud'])AND
isset($_POST['clas_preced'])AND
isset($_POST['annee_scol']) // ici tu as oublié de fermer ton if avec une parenthèse fermente )
wow merci j'ai pu approrter des modifications a mon script mais voici la finalité ,mais tjour pas du tout bn:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Nouvelle page php pour formulaire d'inscription</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="new_form.php">
</p>
<p class="Style1">Nom
<input type="text" name="nom" id="nom" />
</p>
<p class="Style1">Prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p class="Style1">E-mail
<input type="text" name="email" id="email" />
</p>
<p class="Style1">Date de Naissance
<input type="text" name="dat_nais" id="dat_nais" />
</p>
<p class="Style1">Lieu de Naissance
<input type="text" name="lieu" id="lieu" />
</p>
<p class="Style1">Sexe
<select name="sexe" size="1" id="sexe">
<option>Masculin</option>
<option>Feminin</option>
</select>
</p>
<p class="Style1">Nationalite
<input type="text" name="nationalite" id="nationalite" />
</p>
<p class="Style1">Nom et Prenom du Pere
<input type="text" name="ref_pere" id="ref_pere" />
</p>
<p class="Style1">Nom et Prenom de la Mere
<input type="text" name="ref_mere" id="ref_mere" />
</p>
<p class="Style1">Adresse
<input type="text" name="adresse" id="adresse" />
</p>
<p class="Style1">Etablissement
<input type="text" name="etablissement" id="etablissement" />
</p>
<p class="Style1">Niveau d'Etude
<select name="nivo_etud" size="1" id="nivo_etud">
<option>BEPE</option>
<option>CEPE</option>
<option>Terminal</option>
<option>BAC</option>
<option>BAC +1</option>
<option>BAC +2</option>
<option>BAC +3</option>
<option>BAC +4</option>
<option>BAC +5</option>
</select>
</p>
<p class="Style1">Classe de l'annee Precedente
<input type="text" name="clas_preced" id="clas_preced" />
</p>
<p class="Style1">Annee Scolaire
<input type="text" name="annee_scol" id="annee_scol" />
</p>
<p class="Style1"></p>
<p align="center" class="Style1">
<input type="submit" name="button" id="button" value="Envoyer" />
</p>
<p align="center" class="Style1">
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
<?php
//debut du script
if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol']))
//ensuite je verifie si mes données ne sont pas nul
{
if($_POST['nom'] != NULL and $_POST['prenom'] != NULL and $_POST['email'] != NULL and $_POST['dat_nais'] != NULL and $_POST['lieu'] != NULL and $_POST['sexe'] != NULL and $_POST['nationalite'] != NULL and $_POST['ref_pere'] != NULL and $_POST['ref_mere'] != NULL and $_POST['adresse'] != NULL and $_POST['etablissement'] != NULL and $_POST['nivo_etud'] != NULL and $_POST['clas_preced'] != NULL and $_POST['annee_scol'] != NULL )
//on va securiser les données avant de les transferer dans la base de données
{$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));$prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email']));$dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite']));$ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere']));$ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere']));$adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse']));$etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement']));$nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud']));$clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced']));
$annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol']));
//connexion a la base de donnée
{
mysql_connect("localhost","root","");
mysql_select_db("bd_inscription");
// Ensuite on enregistre le message
mysql_query("INSERT INTO inscrits VALUES('', '$nom',$prenom,$email , $dat_nais, $lieu , $sexe , $nationalite, $ref_pere,$ref_mere , $adresse , $etablissement , $nivo_etud ,$clas_preced ,$annee_scol ");
// On se déconnecte de MySQL
mysql_close();
//Ici si le message a été enregistrer alors on va afficher le texte
echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité";
}
}
}
?>
</body>
</html>
//j'arrive pas a inserer cette partie correctement
if($_POST['nom'] == NULL and $_POST['prenom'] == NULL and $_POST['email'] == NULL and $_POST['dat_nais'] == NULL and $_POST['lieu'] == NULL and $_POST['sexe'] == NULL and $_POST['nationalite'] == NULL and $_POST['ref_pere'] == NULL and $_POST['ref_mere'] == NULL and $_POST['adresse'] == NULL and $_POST['etablissement'] == NULL and $_POST['nivo_etud'] == NULL and $_POST['clas_preced'] == NULL and $_POST['annee_scol'] == NULL )
{
echo "Veuillez remplir le formulaire"
}
Voici ma table :
--
-- Base de données: `bd_inscription`
--
-- --------------------------------------------------------
--
-- Structure de la table `inscrits`
--
CREATE TABLE `inscrits` (
`id` int(11) NOT NULL auto_increment,
`nom` text NOT NULL,
`prenom` text NOT NULL,
`email` text NOT NULL,
`dat_nais` text NOT NULL,
`lieu` text NOT NULL,
`sexe` text NOT NULL,
`nationalite` text NOT NULL,
`ref_pere` text NOT NULL,
`ref_mere` text NOT NULL,
`adresse` text NOT NULL,
`etablissement` text NOT NULL,
`nivo_etud` text NOT NULL,
`clas_preced` text NOT NULL,
`annee_scol` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Nouvelle page php pour formulaire d'inscription</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="new_form.php">
</p>
<p class="Style1">Nom
<input type="text" name="nom" id="nom" />
</p>
<p class="Style1">Prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p class="Style1">E-mail
<input type="text" name="email" id="email" />
</p>
<p class="Style1">Date de Naissance
<input type="text" name="dat_nais" id="dat_nais" />
</p>
<p class="Style1">Lieu de Naissance
<input type="text" name="lieu" id="lieu" />
</p>
<p class="Style1">Sexe
<select name="sexe" size="1" id="sexe">
<option>Masculin</option>
<option>Feminin</option>
</select>
</p>
<p class="Style1">Nationalite
<input type="text" name="nationalite" id="nationalite" />
</p>
<p class="Style1">Nom et Prenom du Pere
<input type="text" name="ref_pere" id="ref_pere" />
</p>
<p class="Style1">Nom et Prenom de la Mere
<input type="text" name="ref_mere" id="ref_mere" />
</p>
<p class="Style1">Adresse
<input type="text" name="adresse" id="adresse" />
</p>
<p class="Style1">Etablissement
<input type="text" name="etablissement" id="etablissement" />
</p>
<p class="Style1">Niveau d'Etude
<select name="nivo_etud" size="1" id="nivo_etud">
<option>BEPE</option>
<option>CEPE</option>
<option>Terminal</option>
<option>BAC</option>
<option>BAC +1</option>
<option>BAC +2</option>
<option>BAC +3</option>
<option>BAC +4</option>
<option>BAC +5</option>
</select>
</p>
<p class="Style1">Classe de l'annee Precedente
<input type="text" name="clas_preced" id="clas_preced" />
</p>
<p class="Style1">Annee Scolaire
<input type="text" name="annee_scol" id="annee_scol" />
</p>
<p class="Style1"></p>
<p align="center" class="Style1">
<input type="submit" name="button" id="button" value="Envoyer" />
</p>
<p align="center" class="Style1">
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
<?php
//debut du script
if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol']))
//ensuite je verifie si mes données ne sont pas nul
{
if($_POST['nom'] != NULL and $_POST['prenom'] != NULL and $_POST['email'] != NULL and $_POST['dat_nais'] != NULL and $_POST['lieu'] != NULL and $_POST['sexe'] != NULL and $_POST['nationalite'] != NULL and $_POST['ref_pere'] != NULL and $_POST['ref_mere'] != NULL and $_POST['adresse'] != NULL and $_POST['etablissement'] != NULL and $_POST['nivo_etud'] != NULL and $_POST['clas_preced'] != NULL and $_POST['annee_scol'] != NULL )
//on va securiser les données avant de les transferer dans la base de données
{$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));$prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email']));$dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite']));$ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere']));$ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere']));$adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse']));$etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement']));$nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud']));$clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced']));
$annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol']));
//connexion a la base de donnée
{
mysql_connect("localhost","root","");
mysql_select_db("bd_inscription");
// Ensuite on enregistre le message
mysql_query("INSERT INTO inscrits VALUES('', '$nom',$prenom,$email , $dat_nais, $lieu , $sexe , $nationalite, $ref_pere,$ref_mere , $adresse , $etablissement , $nivo_etud ,$clas_preced ,$annee_scol ");
// On se déconnecte de MySQL
mysql_close();
//Ici si le message a été enregistrer alors on va afficher le texte
echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité";
}
}
}
?>
</body>
</html>
//j'arrive pas a inserer cette partie correctement
if($_POST['nom'] == NULL and $_POST['prenom'] == NULL and $_POST['email'] == NULL and $_POST['dat_nais'] == NULL and $_POST['lieu'] == NULL and $_POST['sexe'] == NULL and $_POST['nationalite'] == NULL and $_POST['ref_pere'] == NULL and $_POST['ref_mere'] == NULL and $_POST['adresse'] == NULL and $_POST['etablissement'] == NULL and $_POST['nivo_etud'] == NULL and $_POST['clas_preced'] == NULL and $_POST['annee_scol'] == NULL )
{
echo "Veuillez remplir le formulaire"
}
Voici ma table :
--
-- Base de données: `bd_inscription`
--
-- --------------------------------------------------------
--
-- Structure de la table `inscrits`
--
CREATE TABLE `inscrits` (
`id` int(11) NOT NULL auto_increment,
`nom` text NOT NULL,
`prenom` text NOT NULL,
`email` text NOT NULL,
`dat_nais` text NOT NULL,
`lieu` text NOT NULL,
`sexe` text NOT NULL,
`nationalite` text NOT NULL,
`ref_pere` text NOT NULL,
`ref_mere` text NOT NULL,
`adresse` text NOT NULL,
`etablissement` text NOT NULL,
`nivo_etud` text NOT NULL,
`clas_preced` text NOT NULL,
`annee_scol` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
wow merci j'ai pu approrter des modifications a mon script mais voici la finalité ,mais tjour pas du tout bn:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Nouvelle page php pour formulaire d'inscription</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="new_form.php">
</p>
<p class="Style1">Nom
<input type="text" name="nom" id="nom" />
</p>
<p class="Style1">Prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p class="Style1">E-mail
<input type="text" name="email" id="email" />
</p>
<p class="Style1">Date de Naissance
<input type="text" name="dat_nais" id="dat_nais" />
</p>
<p class="Style1">Lieu de Naissance
<input type="text" name="lieu" id="lieu" />
</p>
<p class="Style1">Sexe
<select name="sexe" size="1" id="sexe">
<option>Masculin</option>
<option>Feminin</option>
</select>
</p>
<p class="Style1">Nationalite
<input type="text" name="nationalite" id="nationalite" />
</p>
<p class="Style1">Nom et Prenom du Pere
<input type="text" name="ref_pere" id="ref_pere" />
</p>
<p class="Style1">Nom et Prenom de la Mere
<input type="text" name="ref_mere" id="ref_mere" />
</p>
<p class="Style1">Adresse
<input type="text" name="adresse" id="adresse" />
</p>
<p class="Style1">Etablissement
<input type="text" name="etablissement" id="etablissement" />
</p>
<p class="Style1">Niveau d'Etude
<select name="nivo_etud" size="1" id="nivo_etud">
<option>BEPE</option>
<option>CEPE</option>
<option>Terminal</option>
<option>BAC</option>
<option>BAC +1</option>
<option>BAC +2</option>
<option>BAC +3</option>
<option>BAC +4</option>
<option>BAC +5</option>
</select>
</p>
<p class="Style1">Classe de l'annee Precedente
<input type="text" name="clas_preced" id="clas_preced" />
</p>
<p class="Style1">Annee Scolaire
<input type="text" name="annee_scol" id="annee_scol" />
</p>
<p class="Style1"></p>
<p align="center" class="Style1">
<input type="submit" name="button" id="button" value="Envoyer" />
</p>
<p align="center" class="Style1">
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
<?php
//debut du script
if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol']))
//ensuite je verifie si mes données ne sont pas nul
{
if($_POST['nom'] != NULL and $_POST['prenom'] != NULL and $_POST['email'] != NULL and $_POST['dat_nais'] != NULL and $_POST['lieu'] != NULL and $_POST['sexe'] != NULL and $_POST['nationalite'] != NULL and $_POST['ref_pere'] != NULL and $_POST['ref_mere'] != NULL and $_POST['adresse'] != NULL and $_POST['etablissement'] != NULL and $_POST['nivo_etud'] != NULL and $_POST['clas_preced'] != NULL and $_POST['annee_scol'] != NULL )
//on va securiser les données avant de les transferer dans la base de données
{$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));$prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email']));$dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite']));$ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere']));$ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere']));$adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse']));$etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement']));$nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud']));$clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced']));
$annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol']));
//connexion a la base de donnée
{
mysql_connect("localhost","root","");
mysql_select_db("bd_inscription");
// Ensuite on enregistre le message
mysql_query("INSERT INTO inscrits VALUES('', '$nom',$prenom,$email , $dat_nais, $lieu , $sexe , $nationalite, $ref_pere,$ref_mere , $adresse , $etablissement , $nivo_etud ,$clas_preced ,$annee_scol ");
// On se déconnecte de MySQL
mysql_close();
//Ici si le message a été enregistrer alors on va afficher le texte
echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité";
}
}
}
?>
</body>
</html>
//j'arrive pas a inserer cette partie correctement
if($_POST['nom'] == NULL and $_POST['prenom'] == NULL and $_POST['email'] == NULL and $_POST['dat_nais'] == NULL and $_POST['lieu'] == NULL and $_POST['sexe'] == NULL and $_POST['nationalite'] == NULL and $_POST['ref_pere'] == NULL and $_POST['ref_mere'] == NULL and $_POST['adresse'] == NULL and $_POST['etablissement'] == NULL and $_POST['nivo_etud'] == NULL and $_POST['clas_preced'] == NULL and $_POST['annee_scol'] == NULL )
{
echo "Veuillez remplir le formulaire"
}
Voici ma table :
--
-- Base de données: `bd_inscription`
--
-- --------------------------------------------------------
--
-- Structure de la table `inscrits`
--
CREATE TABLE `inscrits` (
`id` int(11) NOT NULL auto_increment,
`nom` text NOT NULL,
`prenom` text NOT NULL,
`email` text NOT NULL,
`dat_nais` text NOT NULL,
`lieu` text NOT NULL,
`sexe` text NOT NULL,
`nationalite` text NOT NULL,
`ref_pere` text NOT NULL,
`ref_mere` text NOT NULL,
`adresse` text NOT NULL,
`etablissement` text NOT NULL,
`nivo_etud` text NOT NULL,
`clas_preced` text NOT NULL,
`annee_scol` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Nouvelle page php pour formulaire d'inscription</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="new_form.php">
</p>
<p class="Style1">Nom
<input type="text" name="nom" id="nom" />
</p>
<p class="Style1">Prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p class="Style1">E-mail
<input type="text" name="email" id="email" />
</p>
<p class="Style1">Date de Naissance
<input type="text" name="dat_nais" id="dat_nais" />
</p>
<p class="Style1">Lieu de Naissance
<input type="text" name="lieu" id="lieu" />
</p>
<p class="Style1">Sexe
<select name="sexe" size="1" id="sexe">
<option>Masculin</option>
<option>Feminin</option>
</select>
</p>
<p class="Style1">Nationalite
<input type="text" name="nationalite" id="nationalite" />
</p>
<p class="Style1">Nom et Prenom du Pere
<input type="text" name="ref_pere" id="ref_pere" />
</p>
<p class="Style1">Nom et Prenom de la Mere
<input type="text" name="ref_mere" id="ref_mere" />
</p>
<p class="Style1">Adresse
<input type="text" name="adresse" id="adresse" />
</p>
<p class="Style1">Etablissement
<input type="text" name="etablissement" id="etablissement" />
</p>
<p class="Style1">Niveau d'Etude
<select name="nivo_etud" size="1" id="nivo_etud">
<option>BEPE</option>
<option>CEPE</option>
<option>Terminal</option>
<option>BAC</option>
<option>BAC +1</option>
<option>BAC +2</option>
<option>BAC +3</option>
<option>BAC +4</option>
<option>BAC +5</option>
</select>
</p>
<p class="Style1">Classe de l'annee Precedente
<input type="text" name="clas_preced" id="clas_preced" />
</p>
<p class="Style1">Annee Scolaire
<input type="text" name="annee_scol" id="annee_scol" />
</p>
<p class="Style1"></p>
<p align="center" class="Style1">
<input type="submit" name="button" id="button" value="Envoyer" />
</p>
<p align="center" class="Style1">
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
<?php
//debut du script
if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol']))
//ensuite je verifie si mes données ne sont pas nul
{
if($_POST['nom'] != NULL and $_POST['prenom'] != NULL and $_POST['email'] != NULL and $_POST['dat_nais'] != NULL and $_POST['lieu'] != NULL and $_POST['sexe'] != NULL and $_POST['nationalite'] != NULL and $_POST['ref_pere'] != NULL and $_POST['ref_mere'] != NULL and $_POST['adresse'] != NULL and $_POST['etablissement'] != NULL and $_POST['nivo_etud'] != NULL and $_POST['clas_preced'] != NULL and $_POST['annee_scol'] != NULL )
//on va securiser les données avant de les transferer dans la base de données
{$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));$prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email']));$dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite']));$ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere']));$ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere']));$adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse']));$etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement']));$nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud']));$clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced']));
$annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol']));
//connexion a la base de donnée
{
mysql_connect("localhost","root","");
mysql_select_db("bd_inscription");
// Ensuite on enregistre le message
mysql_query("INSERT INTO inscrits VALUES('', '$nom',$prenom,$email , $dat_nais, $lieu , $sexe , $nationalite, $ref_pere,$ref_mere , $adresse , $etablissement , $nivo_etud ,$clas_preced ,$annee_scol ");
// On se déconnecte de MySQL
mysql_close();
//Ici si le message a été enregistrer alors on va afficher le texte
echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité";
}
}
}
?>
</body>
</html>
//j'arrive pas a inserer cette partie correctement
if($_POST['nom'] == NULL and $_POST['prenom'] == NULL and $_POST['email'] == NULL and $_POST['dat_nais'] == NULL and $_POST['lieu'] == NULL and $_POST['sexe'] == NULL and $_POST['nationalite'] == NULL and $_POST['ref_pere'] == NULL and $_POST['ref_mere'] == NULL and $_POST['adresse'] == NULL and $_POST['etablissement'] == NULL and $_POST['nivo_etud'] == NULL and $_POST['clas_preced'] == NULL and $_POST['annee_scol'] == NULL )
{
echo "Veuillez remplir le formulaire"
}
Voici ma table :
--
-- Base de données: `bd_inscription`
--
-- --------------------------------------------------------
--
-- Structure de la table `inscrits`
--
CREATE TABLE `inscrits` (
`id` int(11) NOT NULL auto_increment,
`nom` text NOT NULL,
`prenom` text NOT NULL,
`email` text NOT NULL,
`dat_nais` text NOT NULL,
`lieu` text NOT NULL,
`sexe` text NOT NULL,
`nationalite` text NOT NULL,
`ref_pere` text NOT NULL,
`ref_mere` text NOT NULL,
`adresse` text NOT NULL,
`etablissement` text NOT NULL,
`nivo_etud` text NOT NULL,
`clas_preced` text NOT NULL,
`annee_scol` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
niahoo
Messages postés
247
Date d'inscription
lundi 24 décembre 2007
Statut
Membre
Dernière intervention
23 mai 2010
19
10 févr. 2009 à 12:31
10 févr. 2009 à 12:31
echo "Veuillez remplir le formulaire"
manque le point virgule
manque le point virgule
Ben j'ai tt tenter mais voici ma reponse final ala fin de mon script
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité
Enfin voici mon code avec mes dernieres modifications:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Nouvelle page php pour formulaire d'inscription</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="new_form.php">
</p>
<p class="Style1">Nom
<input type="text" name="nom" id="nom" />
</p>
<p class="Style1">Prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p class="Style1">E-mail
<input type="text" name="email" id="email" />
</p>
<p class="Style1">Date de Naissance
<input type="text" name="dat_nais" id="dat_nais" />
</p>
<p class="Style1">Lieu de Naissance
<input type="text" name="lieu" id="lieu" />
</p>
<p class="Style1">Sexe
<select name="sexe" size="1" id="sexe">
<option>Masculin</option>
<option>Feminin</option>
</select>
</p>
<p class="Style1">Nationalite
<input type="text" name="nationalite" id="nationalite" />
</p>
<p class="Style1">Nom et Prenom du Pere
<input type="text" name="ref_pere" id="ref_pere" />
</p>
<p class="Style1">Nom et Prenom de la Mere
<input type="text" name="ref_mere" id="ref_mere" />
</p>
<p class="Style1">Adresse
<input type="text" name="adresse" id="adresse" />
</p>
<p class="Style1">Etablissement
<input type="text" name="etablissement" id="etablissement" />
</p>
<p class="Style1">Niveau d'Etude
<select name="nivo_etud" size="1" id="nivo_etud">
<option>BEPE</option>
<option>CEPE</option>
<option>Terminal</option>
<option>BAC</option>
<option>BAC +1</option>
<option>BAC +2</option>
<option>BAC +3</option>
<option>BAC +4</option>
<option>BAC +5</option>
</select>
</p>
<p class="Style1">Classe de l'annee Precedente
<input type="text" name="clas_preced" id="clas_preced" />
</p>
<p class="Style1">Annee Scolaire
<input type="text" name="annee_scol" id="annee_scol" />
</p>
<p class="Style1"></p>
<p align="center" class="Style1">
<input type="submit" name="button" id="button" value="Envoyer" />
</p>
<p align="center" class="Style1">
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
<?php
//debut du script
if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol']))
//ensuite je verifie si mes données ne sont pas nul
{
if($_POST['nom'] != NULL and $_POST['prenom'] != NULL and $_POST['email'] != NULL and $_POST['dat_nais'] != NULL and $_POST['lieu'] != NULL and $_POST['sexe'] != NULL and $_POST['nationalite'] != NULL and $_POST['ref_pere'] != NULL and $_POST['ref_mere'] != NULL and $_POST['adresse'] != NULL and $_POST['etablissement'] != NULL and $_POST['nivo_etud'] != NULL and $_POST['clas_preced'] != NULL and $_POST['annee_scol'] != NULL )
//on va securiser les données avant de les transferer dans la base de données
{$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));$prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email']));$dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite']));$ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere']));$ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere']));$adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse']));$etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement']));$nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud']));$clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced']));$annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol']));
//connexion a la base de donnée
{
mysql_connect("localhost","root","");
mysql_select_db("bd_inscription");
// Ensuite on enregistre le message
mysql_query("INSERT INTO inscrits VALUES('', '$nom',$prenom,$email , $dat_nais, $lieu , $sexe , $nationalite, $ref_pere,$ref_mere , $adresse , $etablissement , $nivo_etud ,$clas_preced ,$annee_scol ");
// On se déconnecte de MySQL
mysql_close();
//Ici si le message a été enregistrer alors on va afficher le texte
echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité";
}
}
}
if($_POST['nom'] == NULL and $_POST['prenom'] == NULL and $_POST['email'] == NULL and $_POST['dat_nais'] == NULL and $_POST['lieu'] == NULL and $_POST['sexe'] == NULL and $_POST['nationalite'] == NULL and $_POST['ref_pere'] == NULL and $_POST['ref_mere'] == NULL and $_POST['adresse'] == NULL and $_POST['etablissement'] == NULL and $_POST['nivo_etud'] == NULL and $_POST['clas_preced'] == NULL and $_POST['annee_scol'] == NULL )
{
echo "Veuillez remplir le formulaire";
}
?>
</body>
</html>
Je n'arrive pas a trouver la resolution
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\new_form.php on line 79
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\wamp\www\test\new_form.php on line 79
Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité
Enfin voici mon code avec mes dernieres modifications:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Nouvelle page php pour formulaire d'inscription</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="new_form.php">
</p>
<p class="Style1">Nom
<input type="text" name="nom" id="nom" />
</p>
<p class="Style1">Prenom
<input type="text" name="prenom" id="prenom" />
</p>
<p class="Style1">E-mail
<input type="text" name="email" id="email" />
</p>
<p class="Style1">Date de Naissance
<input type="text" name="dat_nais" id="dat_nais" />
</p>
<p class="Style1">Lieu de Naissance
<input type="text" name="lieu" id="lieu" />
</p>
<p class="Style1">Sexe
<select name="sexe" size="1" id="sexe">
<option>Masculin</option>
<option>Feminin</option>
</select>
</p>
<p class="Style1">Nationalite
<input type="text" name="nationalite" id="nationalite" />
</p>
<p class="Style1">Nom et Prenom du Pere
<input type="text" name="ref_pere" id="ref_pere" />
</p>
<p class="Style1">Nom et Prenom de la Mere
<input type="text" name="ref_mere" id="ref_mere" />
</p>
<p class="Style1">Adresse
<input type="text" name="adresse" id="adresse" />
</p>
<p class="Style1">Etablissement
<input type="text" name="etablissement" id="etablissement" />
</p>
<p class="Style1">Niveau d'Etude
<select name="nivo_etud" size="1" id="nivo_etud">
<option>BEPE</option>
<option>CEPE</option>
<option>Terminal</option>
<option>BAC</option>
<option>BAC +1</option>
<option>BAC +2</option>
<option>BAC +3</option>
<option>BAC +4</option>
<option>BAC +5</option>
</select>
</p>
<p class="Style1">Classe de l'annee Precedente
<input type="text" name="clas_preced" id="clas_preced" />
</p>
<p class="Style1">Annee Scolaire
<input type="text" name="annee_scol" id="annee_scol" />
</p>
<p class="Style1"></p>
<p align="center" class="Style1">
<input type="submit" name="button" id="button" value="Envoyer" />
</p>
<p align="center" class="Style1">
<input type="reset" name="button2" id="button2" value="Annuler" />
</p>
<?php
//debut du script
if (isset($_POST['nom']) AND isset($_POST['prenom'])AND isset($_POST['email'])AND isset($_POST['dat_nais'])AND isset($_POST['lieu'])AND isset($_POST['sexe'])AND isset($_POST['nationalite'])AND isset($_POST['ref_pere'])AND isset($_POST['ref_mere'])AND isset($_POST['adresse'])AND isset($_POST['etablissement'])AND isset($_POST['nivo_etud'])AND isset($_POST['clas_preced'])AND isset($_POST['annee_scol']))
//ensuite je verifie si mes données ne sont pas nul
{
if($_POST['nom'] != NULL and $_POST['prenom'] != NULL and $_POST['email'] != NULL and $_POST['dat_nais'] != NULL and $_POST['lieu'] != NULL and $_POST['sexe'] != NULL and $_POST['nationalite'] != NULL and $_POST['ref_pere'] != NULL and $_POST['ref_mere'] != NULL and $_POST['adresse'] != NULL and $_POST['etablissement'] != NULL and $_POST['nivo_etud'] != NULL and $_POST['clas_preced'] != NULL and $_POST['annee_scol'] != NULL )
//on va securiser les données avant de les transferer dans la base de données
{$nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));$prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email']));$dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite']));$ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere']));$ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere']));$adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse']));$etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement']));$nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud']));$clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced']));$annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol']));
//connexion a la base de donnée
{
mysql_connect("localhost","root","");
mysql_select_db("bd_inscription");
// Ensuite on enregistre le message
mysql_query("INSERT INTO inscrits VALUES('', '$nom',$prenom,$email , $dat_nais, $lieu , $sexe , $nationalite, $ref_pere,$ref_mere , $adresse , $etablissement , $nivo_etud ,$clas_preced ,$annee_scol ");
// On se déconnecte de MySQL
mysql_close();
//Ici si le message a été enregistrer alors on va afficher le texte
echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité";
}
}
}
if($_POST['nom'] == NULL and $_POST['prenom'] == NULL and $_POST['email'] == NULL and $_POST['dat_nais'] == NULL and $_POST['lieu'] == NULL and $_POST['sexe'] == NULL and $_POST['nationalite'] == NULL and $_POST['ref_pere'] == NULL and $_POST['ref_mere'] == NULL and $_POST['adresse'] == NULL and $_POST['etablissement'] == NULL and $_POST['nivo_etud'] == NULL and $_POST['clas_preced'] == NULL and $_POST['annee_scol'] == NULL )
{
echo "Veuillez remplir le formulaire";
}
?>
</body>
</html>
Je n'arrive pas a trouver la resolution
974_Vin's_974
Messages postés
547
Date d'inscription
vendredi 23 janvier 2009
Statut
Membre
Dernière intervention
19 février 2009
102
11 févr. 2009 à 05:41
11 févr. 2009 à 05:41
Bon yavé beaucoup d'érreur :
En php AND n'existe pas, tu dois mettre && ...
j'ai tout modifier, remplace ton code par celui là, et tien moi au courant
voila !!!
En php AND n'existe pas, tu dois mettre && ...
j'ai tout modifier, remplace ton code par celui là, et tien moi au courant
<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head> <title>Nouvelle page php pour formulaire d'inscription</title> </head> <body> <form id="form1" name="form1" method="post" action="new_form.php"> <p class="Style1">Nom <input type="text" name="nom" id="nom" /> </p> <p class="Style1">Prenom <input type="text" name="prenom" id="prenom" /> </p> <p class="Style1">E-mail <input type="text" name="email" id="email" /> </p> <p class="Style1">Date de Naissance <input type="text" name="dat_nais" id="dat_nais" /> </p> <p class="Style1">Lieu de Naissance <input type="text" name="lieu" id="lieu" /> </p> <p class="Style1">Sexe <select name="sexe" size="1" id="sexe"> <option>Masculin</option> <option>Feminin</option> </select> </p> <p class="Style1">Nationalite <input type="text" name="nationalite" id="nationalite" /> </p> <p class="Style1">Nom et Prenom du Pere <input type="text" name="ref_pere" id="ref_pere" /> </p> <p class="Style1">Nom et Prenom de la Mere <input type="text" name="ref_mere" id="ref_mere" /> </p> <p class="Style1">Adresse <input type="text" name="adresse" id="adresse" /> </p> <p class="Style1">Etablissement <input type="text" name="etablissement" id="etablissement" /> </p> <p class="Style1">Niveau d'Etude <select name="nivo_etud" size="1" id="nivo_etud"> <option>BEPE</option> <option>CEPE</option> <option>Terminal</option> <option>BAC</option> <option>BAC +1</option> <option>BAC +2</option> <option>BAC +3</option> <option>BAC +4</option> <option>BAC +5</option> </select> </p> <p class="Style1">Classe de l'annee Precedente <input type="text" name="clas_preced" id="clas_preced" /> </p> <p class="Style1">Annee Scolaire <input type="text" name="annee_scol" id="annee_scol" /> </p> <p class="Style1"></p> <p align="center" class="Style1"> <input type="submit" name="button" id="button" value="Envoyer" /> </p> <p align="center" class="Style1"> <input type="reset" name="button2" id="button2" value="Annuler" /> </p> <?php //debut du script if (isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['email']) && isset($_POST['dat_nais']) && isset($_POST['lieu']) && isset($_POST['sexe']) && isset($_POST['nationalite']) && isset($_POST['ref_pere']) && isset($_POST['ref_mere'])&& isset($_POST['adresse']) && isset($_POST['etablissement']) && isset($_POST['nivo_etud']) && isset($_POST['clas_preced']) && isset($_POST['annee_scol'])) //ensuite je verifie si mes données ne sont pas nul { if($_POST['nom'] != null && $_POST['prenom'] != null && $_POST['email'] != null && $_POST['dat_nais'] != null && $_POST['lieu'] != null && $_POST['sexe'] != null && $_POST['nationalite'] != null && $_POST['ref_pere'] != null && $_POST['ref_mere'] != null && $_POST['adresse'] != null && $_POST['etablissement'] != null && $_POST['nivo_etud'] != null && $_POST['clas_preced'] != null && $_POST['annee_scol'] !=null ) //on va securiser les données avant de les transferer dans la base de données { $nom = mysql_real_escape_string(htmlspecialchars($_POST['nom'])); $prenom = mysql_real_escape_string(htmlspecialchars( $_POST['prenom'])); $email = mysql_real_escape_string(htmlspecialchars( $_POST['email'])); $dat_nais = mysql_real_escape_string(htmlspecialchars($_POST['dat_nais'])); $lieu = mysql_real_escape_string(htmlspecialchars($_POST['lieu'])); $sexe = mysql_real_escape_string(htmlspecialchars($_POST['sexe'])); $nationalite = mysql_real_escape_string(htmlspecialchars( $_POST['nationalite'])); $ref_pere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_pere'])); $ref_mere = mysql_real_escape_string(htmlspecialchars( $_POST['ref_mere'])); $adresse = mysql_real_escape_string(htmlspecialchars( $_POST['adresse'])); $etablissement = mysql_real_escape_string(htmlspecialchars($_POST['etablissement'])); $nivo_etud = mysql_real_escape_string(htmlspecialchars($_POST['nivo_etud'])); $clas_preced = mysql_real_escape_string(htmlspecialchars( $_POST['clas_preced'])); $annee_scol = mysql_real_escape_string(htmlspecialchars($_POST['annee_scol'])); //connexion a la base de donnée { mysql_connect("localhost","root",""); mysql_select_db("bd_inscription"); // Ensuite on enregistre le message mysql_query("INSERT INTO inscrits VALUES('', '$nom', '$prenom', '$email' , '$dat_nais', '$lieu' , '$sexe' , '$nationalite', '$ref_pere', '$ref_mere' , '$adresse' , '$etablissement' , '$nivo_etud' , '$clas_preced' ,'$annee_scol' "); // On se déconnecte de MySQL mysql_close(); //Ici si le message a été enregistrer alors on va afficher le texte echo "Merci, vous etes inscrit veuillez vous rendre dans nos locaux pour le reglement de la scolarité"; } } } if($_POST['nom'] ==null && $_POST['prenom'] ==null && $_POST['email'] ==null && $_POST['dat_nais'] ==null && $_POST['lieu'] ==null && $_POST['sexe'] ==null && $_POST['nationalite'] ==null && $_POST['ref_pere'] ==null && $_POST['ref_mere'] ==null && $_POST['adresse'] ==null && $_POST['etablissement'] ==null && $_POST['nivo_etud'] ==null && $_POST['clas_preced'] ==null && $_POST['annee_scol'] ==null) { echo "Veuillez remplir le formulaire"; } ?> </body> </html>
voila !!!
niahoo
Messages postés
247
Date d'inscription
lundi 24 décembre 2007
Statut
Membre
Dernière intervention
23 mai 2010
19
12 févr. 2009 à 09:10
12 févr. 2009 à 09:10
mdr en php and n'existe pas ? tous mes scripts fonctionnent avec mais bon, si tu le dis.
974_Vin's_974
Messages postés
547
Date d'inscription
vendredi 23 janvier 2009
Statut
Membre
Dernière intervention
19 février 2009
102
12 févr. 2009 à 09:50
12 févr. 2009 à 09:50
Ben quoi moi je représente dan des conditions And PAR &&, c tout, je voi pas skil y a de marrant ...
^^ ..
Dis moi jveu rir aussi moi x )
^^ ..
Dis moi jveu rir aussi moi x )
niahoo
Messages postés
247
Date d'inscription
lundi 24 décembre 2007
Statut
Membre
Dernière intervention
23 mai 2010
19
12 févr. 2009 à 10:12
12 févr. 2009 à 10:12
tu peux remplacer tous tes' &&' par des 'and' et tous tes '||' par des 'or', ton script foncitonnera très bien. ce qu'il y a de marrant donc, c'est que tu affirmes deux messages plus haut que 'AND' n'existe pas ne php. mais pas grave osef après tout, les deux syntaxes sont équivalentes.
974_Vin's_974
Messages postés
547
Date d'inscription
vendredi 23 janvier 2009
Statut
Membre
Dernière intervention
19 février 2009
102
12 févr. 2009 à 10:16
12 févr. 2009 à 10:16
Oué scuze petite éreure dexpression, c'est pas que ca n'existe pas, c'est que moi j'utilisez pas ca, et donc dans mon langage PHP ca existé pa lool !!!
Mais sinon lé parey mm !!!
Mais sinon lé parey mm !!!