Problème d'insertion
najoua
-
JooS Messages postés 2705 Statut Membre -
JooS Messages postés 2705 Statut Membre -
Bonjour, j'arrive pas à insérer ces données dans ma BD je trouve tjrs un problème au niveau de l'instruction $requete3->execute(array($nom,$prenom,$cne,$cin,$mail,$adresse,$code,$ville,$pays,$nationalite,$tel));
merci de m'aider à résoudre ce problème
<head>
<title>Formulaire d'inscription</title>
</head>
<link rel="stylesheet" media="screen" type="text/css" title="titre du css" href="css.css" />
<?php
require_once("config.php"); ?>
<?php
$nom= isset($_POST['nome']) ? $_POST['nome'] : '';
$prenom = isset($_POST['prenome']) ? $_POST['prenome'] : '';
$cne = isset($_POST['cne']) ? $_POST['cne'] : '';
$cin = isset($_POST['cin']) ? $_POST['cin'] : '';
$mail = isset($_POST['maile']) ? $_POST['maile'] : '';
$adress = isset($_POST['adresse']) ? $_POST['adresse'] : '';
$code = isset($_POST['code']) ? $_POST['code'] : '';
$ville = isset($_POST['villee']) ? $_POST['villee'] : '';
$pays = isset($_POST['payse']) ? $_POST['payse'] : '';
$nationalite = isset($_POST['nationalite']) ? $_POST['nationalite'] : '';
$tel = isset($_POST['tele']) ? $_POST['tele'] : '';
if($nom && $prenom && $cne && $cin && $mail && $adress && $code && $ville && $pays && $nationalite){
//on verifie que le nouveau etudiant n'existe pas deja
$requete=("select cin from etud where cin= ?");
$requete1 =$connexion->prepare($requete);
$requete1->execute(array($cin));
$data = $requete1->fetch();
$retour=$requete1->rowCount();//
if ( $retour==0)
{
// insertion du nouvelle article.
$requete2=("INSERT INTO etud ('nome' ,'prenome','cne','cin','maile','adresse','code','villee','payse','nationalite','tele') VALUES (?,?,?,?,?,?,?,?,?,?,?)");
$requete3=$connexion->prepare($requete2) // on prépare notre requête
$requete3->execute(array($nom,$prenom,$cne,$cin,$mail,$adresse,$code,$ville,$pays,$nationalite,$tel));
$data = $requete3->fetch();
echo 'Inscription réussie';
}
else
{
echo 'Etudiant déjà inscrit';
}
}
else
{
?>
<form action="formin.php" method="post">
<center>
</br><h3><b>Formulaire d'inscription d'étudiant</b></h3>
</br></br>
</center>
<center>
<table>
<tr>
<td align="top" width="400">
<div id="acces">
</br>
Nom* <input type="text" size="24" name="nome" value="" /></br></br>
Prenom* <input type="text" size="24" name="prenome" value="" /></br></br>
CIN* <input type="text" size="24" name="cin" value="" /></br></br>
CNE* <input type="text" size="24" name="cne" value="" /></br></br>
Email* <input type="text" size="24" name="maile" value="" /></br></br>
Adresse* <input type="text" size="24" name="adresse" value="" /></br></br>
Code postal* <input type="text" size="24" name="code" value="" /></br></br>
Ville* <input type="text" size="24" name="villee" value="" /></br></br>
Pays* <input type="text" size="24" name="payse" value="" /></br></br>
Nationalité* <input type="text" size="24" name="nationalite" value="" /></br></br>
Téléphone <input type="text" size="24" name="tele" value="" /></br></br>
</div>
</td>
<td align="top" width="400">
<div id="acces">
</br>
Série de bac* </br></br>
<table>
<tr>
<td> <input name="options" type="checkbox" value="sma" />
Sc.Math A
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="smb" />
Sc.Math B
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="sxp" />
Sc.Ex.Physique
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="sms" />
SVT
</td>
</tr>
</table>
<br/>
Niveau d'étude* </br></br>
<table>
<tr>
<td> <input name="options" type="checkbox" value="bac" />
Bac
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+2" />
Bac+2
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+3" />
Bac+3
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+4" />
Bac+4
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+5" />
Bac+5 ou plus
</div></br></br></br></br></br></br></br></br>
</td>
</tr>
</table>
<td align="top" width="400">
<div id="acces">
</br>
Semestre*</br></br>
<select name="choix">
<option value="choix1">S1</option>
<option value="choix2">S2</option>
<option value="choix3">S3</option>
<option value="choix4">S4</option>
<option value="choix5">S5</option>
<option value="choix6">S6</option>
</select>
</br>
</br> Filiere*</br></br>
<select name="choix"></br>
<option value="choix1">SMI</option>
<option value="choix2">SMA</option>
<option value="choix3">SMP</option>
<option value="choix4">SMC</option>
<option value="choix5">SVT</option>
<option value="choix6">STU</option>
</select>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
</div>
</td>
</tr>
</table>
</tr>
</table>
</br></br></br>
</center>
<center>
<input type="submit" size="24" value="Valider"/>
</br></br>
</center>
</form>
<?php
}
?>
merci de m'aider à résoudre ce problème
<head>
<title>Formulaire d'inscription</title>
</head>
<link rel="stylesheet" media="screen" type="text/css" title="titre du css" href="css.css" />
<?php
require_once("config.php"); ?>
<?php
$nom= isset($_POST['nome']) ? $_POST['nome'] : '';
$prenom = isset($_POST['prenome']) ? $_POST['prenome'] : '';
$cne = isset($_POST['cne']) ? $_POST['cne'] : '';
$cin = isset($_POST['cin']) ? $_POST['cin'] : '';
$mail = isset($_POST['maile']) ? $_POST['maile'] : '';
$adress = isset($_POST['adresse']) ? $_POST['adresse'] : '';
$code = isset($_POST['code']) ? $_POST['code'] : '';
$ville = isset($_POST['villee']) ? $_POST['villee'] : '';
$pays = isset($_POST['payse']) ? $_POST['payse'] : '';
$nationalite = isset($_POST['nationalite']) ? $_POST['nationalite'] : '';
$tel = isset($_POST['tele']) ? $_POST['tele'] : '';
if($nom && $prenom && $cne && $cin && $mail && $adress && $code && $ville && $pays && $nationalite){
//on verifie que le nouveau etudiant n'existe pas deja
$requete=("select cin from etud where cin= ?");
$requete1 =$connexion->prepare($requete);
$requete1->execute(array($cin));
$data = $requete1->fetch();
$retour=$requete1->rowCount();//
if ( $retour==0)
{
// insertion du nouvelle article.
$requete2=("INSERT INTO etud ('nome' ,'prenome','cne','cin','maile','adresse','code','villee','payse','nationalite','tele') VALUES (?,?,?,?,?,?,?,?,?,?,?)");
$requete3=$connexion->prepare($requete2) // on prépare notre requête
$requete3->execute(array($nom,$prenom,$cne,$cin,$mail,$adresse,$code,$ville,$pays,$nationalite,$tel));
$data = $requete3->fetch();
echo 'Inscription réussie';
}
else
{
echo 'Etudiant déjà inscrit';
}
}
else
{
?>
<form action="formin.php" method="post">
<center>
</br><h3><b>Formulaire d'inscription d'étudiant</b></h3>
</br></br>
</center>
<center>
<table>
<tr>
<td align="top" width="400">
<div id="acces">
</br>
Nom* <input type="text" size="24" name="nome" value="" /></br></br>
Prenom* <input type="text" size="24" name="prenome" value="" /></br></br>
CIN* <input type="text" size="24" name="cin" value="" /></br></br>
CNE* <input type="text" size="24" name="cne" value="" /></br></br>
Email* <input type="text" size="24" name="maile" value="" /></br></br>
Adresse* <input type="text" size="24" name="adresse" value="" /></br></br>
Code postal* <input type="text" size="24" name="code" value="" /></br></br>
Ville* <input type="text" size="24" name="villee" value="" /></br></br>
Pays* <input type="text" size="24" name="payse" value="" /></br></br>
Nationalité* <input type="text" size="24" name="nationalite" value="" /></br></br>
Téléphone <input type="text" size="24" name="tele" value="" /></br></br>
</div>
</td>
<td align="top" width="400">
<div id="acces">
</br>
Série de bac* </br></br>
<table>
<tr>
<td> <input name="options" type="checkbox" value="sma" />
Sc.Math A
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="smb" />
Sc.Math B
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="sxp" />
Sc.Ex.Physique
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="sms" />
SVT
</td>
</tr>
</table>
<br/>
Niveau d'étude* </br></br>
<table>
<tr>
<td> <input name="options" type="checkbox" value="bac" />
Bac
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+2" />
Bac+2
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+3" />
Bac+3
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+4" />
Bac+4
</td>
</tr>
<tr>
<td> <input name="options" type="checkbox" value="bac+5" />
Bac+5 ou plus
</div></br></br></br></br></br></br></br></br>
</td>
</tr>
</table>
<td align="top" width="400">
<div id="acces">
</br>
Semestre*</br></br>
<select name="choix">
<option value="choix1">S1</option>
<option value="choix2">S2</option>
<option value="choix3">S3</option>
<option value="choix4">S4</option>
<option value="choix5">S5</option>
<option value="choix6">S6</option>
</select>
</br>
</br> Filiere*</br></br>
<select name="choix"></br>
<option value="choix1">SMI</option>
<option value="choix2">SMA</option>
<option value="choix3">SMP</option>
<option value="choix4">SMC</option>
<option value="choix5">SVT</option>
<option value="choix6">STU</option>
</select>
</br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
</div>
</td>
</tr>
</table>
</tr>
</table>
</br></br></br>
</center>
<center>
<input type="submit" size="24" value="Valider"/>
</br></br>
</center>
</form>
<?php
}
?>
A voir également:
- Problème d'insertion
- Touche insertion clavier - Guide
- Insertion sommaire word - Guide
- Insertion video powerpoint - Guide
- Insertion filigrane word - Guide
- Insertion liste déroulante excel - Guide