Insertionformulaire

Fermé
john - 25 mars 2018 à 03:45
jordane45 Messages postés 38321 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 1 décembre 2024 - 25 mars 2018 à 04:10
Bonjour tous le monde

j'ai besoin de vos aides svp, je crée un formulaire de connexion lorsque j'essai d'affiche les données de la table une erreur se produit le voila
Notice: Undefined index: remarques in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\pw2\projet cabinet\insertionpatient.php on line 20
      • insertion***


Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\pw2\projet cabinet\patientManager.php on line 32
Echec insertion
alors qu'il connecte à la base de donnée
voila le morceau du code que j'ai codé
partie html :
<!DOCTYPE HTML>
<html>

<head>
<meta charset="UTF-8">
<title>inscription </title>
<link rel="stylesheet" href="cssinsertionpatient.css">
</head>

<body>
<div class="inscription">
<div class="inscriptiontitle">
<p>Ajouter patient </p></div>
<div class="contenueinscription">
<form action="insertionpatient.php" method="POST" name="formulaire" onsubmit="return valider();">
<p >N°dossier patient</p>
<div class="input"><input id="nd" name="nd" type="text" size="30" maxlength="30" placeholder="N°dossier...">
</div>
<p >date creation dossier</p>
<div class="input"> <input id="dd" name="date_creation" type="date" >
</div>
<p >Nom </p>
<div class="input"><input id="nom" name="nom" type="text" size="30" maxlength="30" placeholder="nom... ">
</div>
<p >Prénom </p>
<div class="input">
<input name="Prenom" type="text" size="30" maxlength="30" placeholder="prénom..." >
</div>
<p>Date de naissance</p>
<div class="date">
<select name="jour" >
<option value="0">--</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select name="mois">
<option value="0">--</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
<select name="annee">
<option value="0">----</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="1989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
<option value="1980">1980</option>
<option value="1979">1979</option>
<option value="1978">1978</option>
<option value="1977">1977</option>
<option value="1976">1976</option>
<option value="1975">1975</option>
<option value="1974">1974</option>
<option value="1973">1973</option>
<option value="1972">1972</option>
<option value="1971">1971</option>
<option value="1970">1970</option>
<option value="1969">1969</option>
<option value="1968">1968</option>
<option value="1967">1967</option>
<option value="1966">1966</option>
<option value="1965">1965</option>
<option value="1964">1964</option>
<option value="1963">1963</option>
<option value="1962">1962</option>
<option value="1961">1961</option>
<option value="1960">1960</option>
<option value="1959">1959</option>
<option value="1958">1958</option>
<option value="1957">1957</option>
<option value="1956">1956</option>
<option value="1955">1955</option>
<option value="1954">1954</option>
<option value="1953">1953</option>
<option value="1952">1952</option>
<option value="1951">1951</option>
<option value="1950">1950</option>
</select>
</div>
<br>
<p>Sexe <span class="sexe">
<select name="sexe" style="width:50px">
<option value="0">--</option>
<option value="F">F</option>
<option value="M">M</option>
</select>
</span></p>
</td>
<td>
<p>CIN</p>
<div class="input">
<input id="matricule" name="matricule" type="text" size="30" maxlength="30" placeholder="01111111">
</div>
<p >identifier unique</p>
<div class="input"><input id="id_unique" name="id_unique" type="text" size="30" maxlength="30"placeholder="01111111">
<p >type de régime CNAM</p>
<div class="cnam">
<select name="cnam">
<option value="00">-------</option>
<option value="1">système publique </option>
<option value="2">système de remboursement </option>
<option value="3" >système privée </option>
</select>
</div>
<p >Profession</p>
<div class="input"><input id="Profession" name="Profession" type="text" size="30" maxlength="30" placeholder="profession...">
<p >Email</p>
<div class="input"><input id="email" name="email" type="text" size="30" maxlength="30" placeholder="***@***"> </div>
<p >Tel perso</p>
<div class="input"><input id="tp" name="telperso" type="text" size="30" maxlength="30" placeholder="numéro telephne..."> </div>
<p >Tel domicile</p>
<div class="input"><input id="tp" name="teldomicile" type="text" size="30" maxlength="30" placeholder="numéro telephne..."> </div>
<p >Adresse</p>
<div class="input"><textarea id="adresse" rows="5" cols="30" name="adresse" >
</textarea>
<p >Remarques</p>
<div class="input"><textarea id="rq" rows="10" cols="50" name="remarques" >
</textarea>
<div class="btsubmit">
<input type="submit" value="Registre">
</div>
</form>
</div>
</div>
</section>
<footer class="body">
</footer>

</body>

</html>
partie php :
fichier
1)patient.php
<?php
class Patient
{
public $nd;
public $date_creation;
public $nom;
public $prenom;
public $jour;
public $mois;
public $annee;
public $sexe;
public $matricule;
public $id_unique;
public $cnam;
public $profession;
public $email;
public $telperso;
public $teldomicile;
public $adresse;
public $remarques;
public function getNd()
{return $this->nd;}
public function getDate_creation()
{return $this->date_creation;}
public function getNom()
{return $this->nom;}
public function getPrenom()
{return $this->prenom;}
public function getJour()
{return $this->jour;}
public function getMois()
{return $this->mois;}
public function getAnnee()
{return $this->annee;}
public function getSexe()
{return $this->sexe;}
public function getMatricule()
{return $this->matricule;}
public function getId_unique()
{return $this->id_unique;}
public function getCnam()
{return $this->cnam;}
public function getProfession()
{return $this->profession;}
public function getEmail()
{return $this->email;}
public function getTelperso()
{return $this->telperso;}
public function getTeldomicile()
{return $this->teldomicile;}
public function getAdresse()
{return $this->adresse;}
public function getRemarques()
{return $this->remarques;}
public function setNd($nd)
{ $this->nd=(int)$nd;}
public function setDate_creation($date_creation)
{ $this->date_creation=$date_creation;}
public function setNom($nom)
{ if(is_string($nom))
$this->nom=$nom ;
}
public function setPrenom($prenom)
{ if(is_string($prenom))
$this->prenom=$prenom ;
}
public function setJour($jour)
{ $this->jour=(int)$jour;}
public function setMois($mois)
{ $this->mois=(int)$mois;}
public function setAnnee($annee)
{ $this->annee=(int)$annee;}
public function setSexe($sexe)
{ if(is_string($sexe))
$this->sexe=$sexe;
}
public function setMatricule($matricule)
{ $this->matricule=(int)$matricule;}
public function setId_unique($id_unique)
{ $this->id_unique=(int)$id_unique;}
public function setCnam($cnam)
{ if(is_string($cnam))
$this->cnam=$cnam;
}
public function setProfession($profession)
{ if(is_string($profession))
$this->profession=$profession;
}
public function setEmail($email)
{ if(is_string($email))
$this->email=$email;
}
public function setTelperso($telperso)
{ $this->telperso=(int)$telperso;}
public function setTeldomicile($teldomicile)
{ $this->teldomicile=(int)$teldomicile;}
public function setAdresse($adresse)
{ if(is_string($adresse))
$this->adresse=$adresse;
}
public function setRemarques($remarques)
{ if(is_string($remarques))
$this->remarques=$remarques;
}
public function hydrate(array $donnee)
{
foreach ($donnee as $key =>$value)
{
$method='set'.ucfirst($key);
$this->$method($value);
}
}
}
?>
2)patientManager.php
<?php
class PatientManager
{
public $_db ;
public function __construct($db)
{
$this->setDb($db);
}
public function setDb(PDO $db)
{
$this->_db=$db;
}
public function add(Patient $pat)
{
$q=$this->_db->prepare('INSERT INTO liste SET nd =:nd,date_creation =:date_creation,nom =:nom,prenom =:prenom,jour =:jour,mois =:mois,annee =:annee,sexe =:sexe,matricule =:matricule,id_unique =:id_unique,cnam =:id_unique,cnam =:cnam,profession =:profession,email =:email,telperso =:telperso,teldomicile =:teldomicile,adresse =:adresse,remarques =:remarques');
$q->bindValue('nd',$pat->getNd());
$q->bindValue('date_creation',$pat->getDate_creation());
$q->bindValue('nom',$pat->getNom());
$q->bindValue('prenom',$pat->getPrenom());
$q->bindValue('jour',$pat->getJour());
$q->bindValue('mois',$pat->getMois());
$q->bindValue('annee',$pat->getAnnee());
$q->bindValue('sexe',$pat->getSexe());
$q->bindValue('id_unique',$pat->getId_unique());
$q->bindValue('cnam',$pat->getCnam());
$q->bindValue('profession',$pat->getProfession());
$q->bindValue('email',$pat->getEmail());
$q->bindValue('telperso',$pat->getTelperso());
$q->bindValue('teldomicile',$pat->getTeldomicile());
$q->bindValue('adresse',$pat->getAdresse());
$q->bindValue('remarques',$pat->getRemarques());
$r=$q->execute();
if(!$r)
{
echo"Echec insertion";
}
else
echo"Insertion résussie";
}
}
?>
3)insertionpatient.php
<?php
class PatientManager
{
public $_db ;
public function __construct($db)
{
$this->setDb($db);
}
public function setDb(PDO $db)
{
$this->_db=$db;
}
public function add(Patient $pat)
{
$q=$this->_db->prepare('INSERT INTO liste SET nd =:nd,date_creation =:date_creation,nom =:nom,prenom =:prenom,jour =:jour,mois =:mois,annee =:annee,sexe =:sexe,matricule =:matricule,id_unique =:id_unique,cnam =:id_unique,cnam =:cnam,profession =:profession,email =:email,telperso =:telperso,teldomicile =:teldomicile,adresse =:adresse,remarques =:remarques');
$q->bindValue('nd',$pat->getNd());
$q->bindValue('date_creation',$pat->getDate_creation());
$q->bindValue('nom',$pat->getNom());
$q->bindValue('prenom',$pat->getPrenom());
$q->bindValue('jour',$pat->getJour());
$q->bindValue('mois',$pat->getMois());
$q->bindValue('annee',$pat->getAnnee());
$q->bindValue('sexe',$pat->getSexe());
$q->bindValue('id_unique',$pat->getId_unique());
$q->bindValue('cnam',$pat->getCnam());
$q->bindValue('profession',$pat->getProfession());
$q->bindValue('email',$pat->getEmail());
$q->bindValue('telperso',$pat->getTelperso());
$q->bindValue('teldomicile',$pat->getTeldomicile());
$q->bindValue('adresse',$pat->getAdresse());
$q->bindValue('remarques',$pat->getRemarques());
$r=$q->execute();
if(!$r)
{
echo"Echec insertion";
}
else
echo"Insertion résussie";
}
}
?>

1 réponse

jordane45 Messages postés 38321 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 1 décembre 2024 4 707
25 mars 2018 à 04:10
0