Problème avec déclaration des variables.

Problème avec déclaration des variables. - PHP - Programmation

Marsh Posté le 18-10-2005 à 10:45:19    

Bonjour,
 
J'ai déclaré mes variables de cette façon :  
 
$nom = htmlspecialchars(htmlentities($_POST['clinom'], ENT_QUOTES));
$nom = ucfirst($nom);
$prenom = htmlspecialchars(htmlentities($_POST['clipre'], ENT_QUOTES));
$prenom = ucfirst($prenom);
$adresse = htmlspecialchars(htmlentities($_POST['cliadr'], ENT_QUOTES));
$npa = htmlspecialchars(htmlentities($_POST['clinpa'], ENT_QUOTES));
$loc = htmlspecialchars(htmlentities($_POST['cliloc'], ENT_QUOTES));
$tel = htmlspecialchars(htmlentities($_POST['clitel'], ENT_QUOTES));
$mob = htmlspecialchars(htmlentities($_POST['climob'], ENT_QUOTES));
$datenaissance = htmlspecialchars(htmlentities($_POST['clidatenais'], ENT_QUOTES));
$numidentite = htmlspecialchars(htmlentities($_POST['clinumide'], ENT_QUOTES));
$motpasse = htmlspecialchars(htmlentities($_POST['climdp'], ENT_QUOTES));
$cliparraine = htmlspecialchars(htmlentities($_POST['clinum_est_parraine'], ENT_QUOTES));
$clicom = htmlspecialchars(htmlentities($_POST['clicom'], ENT_QUOTES));
 
et quand j'éxécute mon script j'obtient ceci :
 
Notice: Undefined index: clinom in e:\testsphp\ajoutcli.php on line 24
 
Notice: Undefined index: clipre in e:\testsphp\ajoutcli.php on line 26
 
Notice: Undefined index: cliadr in e:\testsphp\ajoutcli.php on line 28
 
Notice: Undefined index: clinpa in e:\testsphp\ajoutcli.php on line 29
 
Notice: Undefined index: cliloc in e:\testsphp\ajoutcli.php on line 30
 
Notice: Undefined index: clitel in e:\testsphp\ajoutcli.php on line 31
 
Notice: Undefined index: climob in e:\testsphp\ajoutcli.php on line 32
 
Notice: Undefined index: clidatenais in e:\testsphp\ajoutcli.php on line 33
 
Notice: Undefined index: clinumide in e:\testsphp\ajoutcli.php on line 34
 
Notice: Undefined index: climdp in e:\testsphp\ajoutcli.php on line 35
 
Notice: Undefined index: clinum_est_parraine in e:\testsphp\ajoutcli.php on line 36
 
Notice: Undefined index: clicom in e:\testsphp\ajoutcli.php on line 37
 
Notice: Undefined index: ajouter in e:\testsphp\ajoutcli.php on line 39

Reply

Marsh Posté le 18-10-2005 à 10:45:19   

Reply

Marsh Posté le 18-10-2005 à 10:46:29    

remplace  
 
$nom = htmlspecialchars(htmlentities($_POST['clinom'], ENT_QUOTES));  
 
pas  

Code :
  1. if(isset($_POST['clinom']))
  2.       $nom = htmlspecialchars(htmlentities($_POST['clinom'], ENT_QUOTES));
  3. else
  4.       $nom="";


 
par contre tu devrai te poser la question " piurquoi est ce que mon tableau post ne contient pas les variables voulues ?" et "est ce que c'est grave ?"


Message édité par flo850 le 18-10-2005 à 10:47:11

---------------

Reply

Marsh Posté le 18-10-2005 à 12:30:36    

J'ai rajouté ce que tu m'as dis de faire mais il y a un problème encore. C'est avec le bouton ajouter. Au tout début du script je l'ai déclaré commeça
 
if (isset($_POST['ajouter'] == 'ajouter'))
 
mais quand j'éxécute ça fait :
 
Parse error: parse error, expecting `','' or `')'' in e:\testsphp\ajoutcli.php on line 24
 

Reply

Marsh Posté le 18-10-2005 à 12:34:01    

Oui c'est bon c'est résolu. Merci

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed