<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.6.2">
</HEAD>
<BODY>
Dans <FONT COLOR="#000000">'ajout_etat_civil_php.inc.php'</FONT> tu ne dois sans doute pas utiliser correctement les variables...<BR>
Probable que tu utilises $nom et ça risque de pas fonctionner du tout....à cause d'un truc dans php.ini qui se nomme "register_globals".<BR>
Il vaut mieux utiliser les variables super globales comme $_POST, $_GET etc..<BR>
si tu mets en début de ton script '<FONT COLOR="#000000">ajout_etat_civil_php.inc.php</FONT>':<BR>
<?php<BR>
print("j'essaie d'imprimer le nom avec \$nom: $nom. <br>"); <BR>
print("j'essaie d'imprimer le nom avec \$_POST[\"nom\"]=" . $_POST["nom"]. ". <br>");<BR>
...<BR>
...<BR>
Tu devrais appréhender la différence....<BR>
Il y à aussi une excellent DOC PHP en français chez nexen et des listes spécialisées PHP...<BR>
Pour plus d'infos essaie déjà dans google:<BR>
$_POST<BR>
et éventuellement <BR>
DOC PHP: la première entrée est la bonne: tu vas directement sur la doc en français chez nexen...<BR>
<BR>
Je te conseille de la récupérer au format PDF et de chercher l'info dans cette DOC et les nombreux tutos qui existent avant de poser une question sur les listes comme fr.comp.lang.php où des gens très bien peuvent te répondre si tu as fait cet effort avant, sinon, ils sont souvent bien moins sympa qu'ici ...<IMG SRC="cid:1126384495.7948.20.camel@localhost.localdomain" ALIGN="middle" ALT=";)" BORDER="0"><BR>
<BR>
J'espère que ça va t'aider un peu quand même,<BR>
<BR>
++<BR>
<BR>
Le samedi 10 septembre 2005 à 09:08 +0200, Nature-Informatique a écrit :
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Jody a écrit :</FONT>
<FONT COLOR="#000000">> Salut,</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> Nature-Informatique a écrit :</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">>>Bonjour,</FONT>
<FONT COLOR="#000000">>></FONT>
<FONT COLOR="#000000">>>Je suis en train de me mettre à php et mysql, j'ai quelques petits</FONT>
<FONT COLOR="#000000">>>soucis avec mes deux premiers script. Un de vous pourrait il me donner</FONT>
<FONT COLOR="#000000">>>un coup de main pour les vérifiant svp?</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> Pas de soucis</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">>>J'expliquerais en privé ce qui ne foncitonne pas, afin de ne pas trop</FONT>
<FONT COLOR="#000000">>>poluer cette liste ;)</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> Sauf si c'est personnel ca peut intérrésser du monde ?</FONT>
<FONT COLOR="#000000">Bon, alors je me lance.</FONT>
<FONT COLOR="#000000">J'ai créé une BD mysql "essai_php" avec une seule table etat_civil_php.</FONT>
<FONT COLOR="#000000">Cela pour apprendre php. J'ai ensuite fait un formulaire afin de remplir </FONT>
<FONT COLOR="#000000">cette table, et un script php pour vérifier la validité de ce qui a été </FONT>
<FONT COLOR="#000000">saisi dans le formulaire, avant de l'insérer dans la table.</FONT>
<FONT COLOR="#000000">La connection à la base de données est faite, et les enrgistrements </FONT>
<FONT COLOR="#000000">ajoutés, à ceci prêt que le N° auto est bien incrémenté, mais les </FONT>
<FONT COLOR="#000000">valeurs des champs ne sont pas ajouté, les champs reste vide.</FONT>
<FONT COLOR="#000000">Je pense que je problème vient du fait que je n'arrive pas à faire </FONT>
<FONT COLOR="#000000">afficher les etiquettes de champ dans le formulaire. Chaque étiquette </FONT>
<FONT COLOR="#000000">étant attachée à un nom de champ. Voici le script du formulaire.</FONT>
<FONT COLOR="#000000"><?</FONT>
<FONT COLOR="#000000">$etiquette = array ("prenom" => "Prénom",</FONT>
<FONT COLOR="#000000"> "nom" => "Nom",</FONT>
<FONT COLOR="#000000"> "tel_fixe" => "Tél_Fixe");</FONT>
<FONT COLOR="#000000">echo "<p><hr></FONT>
<FONT COLOR="#000000"> <form action='ajout_etat_civil_php.inc.php' method='POST'></FONT>
<FONT COLOR="#000000"> <center></FONT>
<FONT COLOR="#000000"><table width='95%' border='1' cellspacing='0' cellpadding='2'></FONT>
<FONT COLOR="#000000"> <tr><td align='right'><b>{$etiquette['Nom']}:</b></td></FONT>
<FONT COLOR="#000000"> <td><input type='text' name='nom' size='35' maxlength='35' value=''></td></FONT>
<FONT COLOR="#000000"> </tr> </FONT>
<FONT COLOR="#000000"> <tr><td align='right'><b>{$etiquette['Prénom']}:</b></td></FONT>
<FONT COLOR="#000000"> <td><input type='text' name='prenom' size='35' maxlength='35' </FONT>
<FONT COLOR="#000000">value=''></td></FONT>
<FONT COLOR="#000000"> </tr></FONT>
<FONT COLOR="#000000"> <tr><td align='right'><b>{$etiquette['Tél_fixe']}:</b></td></FONT>
<FONT COLOR="#000000"> <td><input type='text' name='tel_fixe' size='35' maxlength='35' </FONT>
<FONT COLOR="#000000">value=''></td></FONT>
<FONT COLOR="#000000"> </tr></FONT>
<FONT COLOR="#000000"></table></FONT>
<FONT COLOR="#000000"><p><input type='submit' value='Validez'></FONT>
<FONT COLOR="#000000"> </form></FONT>
<FONT COLOR="#000000"> </center>";</FONT>
<FONT COLOR="#000000">?></FONT>
<FONT COLOR="#000000">Ca c'est le premier problème.</FONT>
<FONT COLOR="#000000">Ensuite, la validation du contenu du formulaire ne fonctionne pas, </FONT>
<FONT COLOR="#000000">quelque soit le contenu saisi, il est toujours validé et ajouté à la </FONT>
<FONT COLOR="#000000">base de données. Mais je pense qu'en solutionnant le premier problème on </FONT>
<FONT COLOR="#000000">aura, au moins en partie, résolu le second.</FONT>
<FONT COLOR="#000000">Voilà, donc si vous avez une idée je suis preneur ;)</FONT>
<FONT COLOR="#000000">A+</FONT>
<FONT COLOR="#000000">Jean Michel</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>