IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

[débutant] Problème de formulaire


Sujet :

Langage PHP

  1. #1
    Futur Membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Mars 2009
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2009
    Messages : 9
    Points : 7
    Points
    7
    Par défaut [débutant] Problème de formulaire
    SLT je trouve un grand probléme dans le codage php.
    mon prob.
    je suis entraint de cree un site web educatif et
    apres codification d'une page pour inserer; le code m'affiche undefined index dans tel champs et voici mon code:
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     
    <?php
    //connection au serveur
      $cnx = mysql_connect( "localhost", "root", "" ) ;
      $db  = mysql_select_db("centre de formation bullarejia",$cnx) ;
         //r&eacute;cup&eacute;ration des valeurs des champs:
    $Cin=$_POST["Cin"];
    $Nom=$_POST["Nom"];
    $Prenom=$_POST["Prenom"];
    $Sexe=$_POST["Sexe"];
    $DNaissance=$_POST["DNaissance"];
    $Adresse=$_POST["Adresse"];
    $Tel=$_POST["Tel"];
    $E_Mail=$_POST["E_Mail"];
    $Motdepasse=$_POST["Motdepasse"];
    $Login=$_POST["Login"];
    $requete= "INSERT INTO enseignant ( `CinE` , `Nom` , `Prenom` , `Sexe` , `DNaissance` , `Adresse` , `Tel` , `E-Mail` , `Login` , `Mot de passe` ) VALUES ('$Cin', '$Nom', '$Prenom', '$Sexe', '$DNaissance', '$Adresse', '$Tel', '$E_Mail', 'Login', '$Motdepasse')"; 
    	    $sql = mysql_query($requete, $cnx) or die( mysql_error() ) ;
          	  if (($Cin <> "") && ($Nom <> "")&& ($Prenom <> "")&& ($Login <> ""))
    		  {
          echo "Merci votre  inscription est confirm&eacute;!";
     
         exit;
     
             }
      ?>

    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
            background-image: url(fond de page mosaique.JPG);
            background-image: url(fond%20de%20page%20mosaique.JPG);
    }
    .Style18 {color: #A52DD2;
            font-size: x-large;
            font-family: Elephant;
    }
    .Style19 {font-size: 24px;
            color: #990000;
            font-style: italic;
            font-weight: bold;
    }
    .Style20 {
            font-size: 18px;
            font-style: italic;
            font-weight: bold;
            font-family: "Comic Sans MS";
    }
    .Style28 {color: #FF0000}
    .Style31 {color: #999999}
    -->
    </style></head>
     
    <body>
    <table width="801" height="142" border="1" align="center">
      <tr>
        <td width="184"><img src="logo.JPG" width="186" height="136" /></td>
        <td width="566"><div align="center"><span class="Style18">Etablissement Bullarejia de Formation</span></div>
            <div align="center"><span class="Style19"><u>Agr&eacute;e par l&rsquo;Etat sous le  n&deg;&nbsp;: 07/051/32</u></span></div></td>
      </tr>
    </table>
    <table width="801" border="0" align="center" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="801" height="66"><marquee width=100% behavior=alternate
    direction=left align=middle>
          <div align="center" class="Style20">Bienvenue dans l'espace Administrateur      </div>
        </marquee> 
        &nbsp;</td>
      </tr>
    </table>
    <table width="801" border="0" align="center" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="278" height="363" valign="top"><table width="76%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="219" height="140" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td width="174" height="140"><p><img src="enseignant.JPG" width="193" height="130" /></p>
                  <p align="center"><strong>Enseignant</strong></p></td>
              </tr>
            </table>        </td>
          </tr>
          <tr>
            <td height="13"></td>
          </tr>
          <tr>
            <td height="34" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td width="174" height="34"><form id="form1" name="form1" method="post" action="">
                  <label>
                    <div align="center">
                      <input type="submit" name="Submit" value="Liste Enseignant" />
                    </div>
                  </label>
                </form>            </td>
              </tr>
            </table>        </td>
          </tr>
          <tr>
            <td height="17"></td>
          </tr>
          <tr>
            <td height="30" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td width="174" height="30"><form id="form2" name="form2" method="post" action="Administrateursuppensei.php">
                  <label>
                    <div align="center">
                      <input name="Submit2" type="submit" value="Supprimer Eseignant" />
                    </div>
                  </label>
                </form>            </td>
              </tr>
            </table>        </td>
          </tr>
          <tr>
            <td height="41">&nbsp;</td>
          </tr>
        </table>    </td>
        <td width="29">&nbsp;</td>
        <td colspan="5" rowspan="2" valign="top"><table width="122%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="293" height="418"><p align="center"><strong>Ajout Eseignant</strong></p>
                <table width="125%" border="0" cellpadding="0" cellspacing="0" bgcolor="#999999">
                <!--DWLayoutTable-->
                <tr>
                  <td width="92" height="35" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="35"><div align="center">N&deg; carte d'identit&eacute; <span class="Style28">*</span></div></td>
                      </tr>
                  </table></td>
                  <td width="228" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="35"><label> </label>
                            <div align="center">
                              <input type="text" name="CinE" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="36" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="36"><div align="center">Nom<span class="Style28">*</span> : </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="36"><label> </label>
                            <div align="center">
                              <input type="text" name="Nom" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="38" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="38"><div align="center">Prenom<span class="Style28">*</span> : </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="38"><label> </label>
                            <div align="center">
                              <input type="text" name="Prenom" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="36" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="36"><div align="center">Sexe<span class="Style28">*</span> : </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="36"><label> </label>
                            <div align="center">
                              <select name="Sexe">
                                <option>Masculin</option>
                                <option>Feminin</option>
                              </select>
                              <span class="Style31">............. </span></div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="37" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="37"><div align="center">Date de Naissance <span class="Style28">*</span></div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="37" valign="top"><label> </label>
                            <div align="center">
                              <input name="DNaissance" type="text" value="jj-mm-aaaa" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="39" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="39"><div align="center">Adresse<span class="Style28">*</span> : </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="39"><label> </label>
                            <div align="center">
                              <input type="text" name="Adresse" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="37" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="37"><div align="center">Tel <span class="Style28">*</span> : </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="37"><label> </label>
                            <div align="center">
                              <input type="text" name="Tel" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="34" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="34"><div align="center">E-Mail <span class="Style28">*</span> : </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="34"><label> </label>
                            <div align="center">
                              <input name="E-Mail" type="text" value="Exemple@exemple.fr" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="40" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="40"><div align="center">Login <span class="Style28">* </span>: </div></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="40"><label> </label>
                            <div align="center">
                              <input type="text" name="Login" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td height="48" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="184" height="48"><p align="center">Mot de Passse <span class="Style28">*</span> : </p></td>
                      </tr>
                  </table></td>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <!--DWLayoutTable-->
                      <tr>
                        <td width="212" height="48"><label> </label>
                            <div align="center">
                              <input type="text" name="Mot de passe" />
                          </div></td>
                      </tr>
                  </table></td>
                </tr>
              </table></td>
            </tr>
          <tr>
            <td height="1"></td>
            </tr>
        </table></td>
        <td width="15">&nbsp;</td>
      </tr>
      <tr>
        <td height="116"></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="36"></td>
        <td></td>
        <td width="92">&nbsp;</td>
        <td colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="288" height="36"><p align="center" class="Style28">* : Tous les champs sont obligatoire. </p>          </td>
          </tr>
        </table>    </td>
        <td width="61">&nbsp;</td>
        <td></td>
      </tr>
      <tr>
        <td height="15"></td>
        <td></td>
        <td></td>
        <td width="158"></td>
        <td width="156"></td>
        <td width="12"></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="47"></td>
        <td></td>
        <td></td>
        <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="158" height="47"><form id="form3" name="form3" method="post" action="ajotenseiconf.php">
              <label>
                <div align="center">
                  <input type="submit" name="Submit3" value="Valider" />
                </div>
              </label>
            </form>
            </td>
          </tr>
        </table>    </td>
        <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="156" height="47"><form id="form4" name="form4" method="post" action="Administrateur.php">
              <label>
                <div align="center">
                  <input type="submit" name="Submit4" value="Acceuil" />
                </div>
              </label>
            </form>
            </td>
          </tr>
        </table>
        </td>
        <td>&nbsp;</td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td height="229"></td>
        <td></td>
        <td></td>
        <td>&nbsp;</td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </table>
    </body>
    </html>

    Merci d'avence de m'aider

  2. #2
    Membre éprouvé
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Points : 1 057
    Points
    1 057
    Par défaut
    Essaye ca :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     
    <?php
    //connection au serveur
      $cnx = mysql_connect( "localhost", "root", "" ) ;
      $db  = mysql_select_db("centre de formation bullarejia",$cnx) ;
         //r&eacute;cup&eacute;ration des valeurs des champs:
    $Cin= isset($_POST["Cin"]) ? $_POST["Cin"] : "";
    $Nom= isset($_POST["Nom"]) ? $_POST["Nom"] : "";
    $Prenom= isset($_POST["Prenom"]) ? $_POST["Prenom"] : "";
    $Sexe= isset($_POST["Sexe"]) ? $_POST["Sexe"] : "";
    $DNaissance= isset($_POST["DNaissance"]) ? $_POST["DNaissance"] : "";
    $Adresse= isset($_POST["Adresse"]) ? $_POST["Adresse"] : "";
    $Tel= isset($_POST["Tel"]) ? $_POST["Tel"] : "";
    $E_Mail= isset($_POST["E_Mail"]) ? $_POST["E_Mail"] : "";
    $Motdepasse= isset($_POST["Motdepasse"]) ? $_POST["Motdepasse"] : "";
    $Login= isset($_POST["Login"]) ? $_POST["Login"] : "";
    $requete= "INSERT INTO enseignant ( `CinE` , `Nom` , `Prenom` , `Sexe` , `DNaissance` , `Adresse` , `Tel` , `E-Mail` , `Login` , `Mot de passe` ) VALUES ('$Cin', '$Nom', '$Prenom', '$Sexe', '$DNaissance', '$Adresse', '$Tel', '$E_Mail', 'Login', '$Motdepasse')"; 
    	    $sql = mysql_query($requete, $cnx) or die( mysql_error() ) ;
          	  if (($Cin != "") && ($Nom != "")&& ($Prenom != "")&& ($Login != ""))
    		  {
          echo "Merci votre  inscription est confirm&eacute;!";
     
         exit;
     
             }
      ?>
    EDIT : en fait j'avais pas fais gaffe à ton code HTML mais je viens de voir que certains champs de ton formulaire (notament Cin, EMail et Motdepasse) n'ont pas le même nom dans le formulaire que dans le PHP, et pour pouvoir le récupèrer il doivent être pareils.
    Exemple :

    HTML :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <input type='text' name='date_naissance' />
    PHP :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $datenaissance = $_POST['date_naissance'];


    Les boutons et existent, servez-vous en

  3. #3
    Futur Membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Mars 2009
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2009
    Messages : 9
    Points : 7
    Points
    7
    Par défaut Un autre probleme
    merci pour la reponce mais le code N'afficher rien.
    et quend j'ouvre la base je trouve une insertion de 0.
    merci.

  4. #4
    Membre averti Avatar de binouzzz19
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    385
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Avril 2007
    Messages : 385
    Points : 368
    Points
    368
    Par défaut
    Ben justement,

    dans ton html, tu as ça
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <input name="E-Mail" type="text" value="Exemple@exemple.fr" />
    alors que dans le php, tu récupères ça
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $E_Mail=$_POST["E_Mail"];
    alors que tu devrais récupérer
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $E_Mail=$_POST["E-Mail"];
    Si ton labeur est dur et que tes résultats sont minces, rappelles-toi qu'un jour, le grand chêne a été un gland comme toi !

  5. #5
    Membre averti Avatar de binouzzz19
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    385
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Avril 2007
    Messages : 385
    Points : 368
    Points
    368
    Par défaut
    De plus, dans le values de ton insert, il te manque le $ de $Login ...

    Qu'entends-tu par
    merci pour la reponce mais le code N'afficher rien.
    PS : je ne réponds pas en MP !

    Cordialement.
    Si ton labeur est dur et que tes résultats sont minces, rappelles-toi qu'un jour, le grand chêne a été un gland comme toi !

  6. #6
    Futur Membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Mars 2009
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2009
    Messages : 9
    Points : 7
    Points
    7
    Par défaut meme prob
    merci de m'entendre,
    le code et 100% correcte mais le msg que j'ai ajouter dans la condition ne s'affiche pas en + au niveau de la base je trouve des zéro non pas les valeur que j'ai saisie

  7. #7
    Membre averti Avatar de binouzzz19
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    385
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Avril 2007
    Messages : 385
    Points : 368
    Points
    368
    Par défaut
    Essaye cela :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    <?php
    //connection au serveur
      $cnx = mysql_connect( "localhost", "root", "" ) ;
      $db  = mysql_select_db("centre de formation bullarejia",$cnx) ;
         //r&eacute;cup&eacute;ration des valeurs des champs:
    $Cin= isset($_POST["Cin"]) ? $_POST["Cin"] : "";
    $Nom= isset($_POST["Nom"]) ? $_POST["Nom"] : "";
    $Prenom= isset($_POST["Prenom"]) ? $_POST["Prenom"] : "";
    $Sexe= isset($_POST["Sexe"]) ? $_POST["Sexe"] : "";
    $DNaissance= isset($_POST["DNaissance"]) ? $_POST["DNaissance"] : "";
    $Adresse= isset($_POST["Adresse"]) ? $_POST["Adresse"] : "";
    $Tel= isset($_POST["Tel"]) ? $_POST["Tel"] : "";
    $E_Mail= isset($_POST["E-Mail"]) ? $_POST["E-Mail"] : "";
    $Motdepasse= isset($_POST["Motdepasse"]) ? $_POST["Motdepasse"] : "";
    $Login= isset($_POST["Login"]) ? $_POST["Login"] : "";
    $requete= "INSERT INTO enseignant ( `CinE` , `Nom` , `Prenom` , `Sexe` , `DNaissance` , `Adresse` , `Tel` , `E-Mail` , `Login` , `Mot de passe` ) VALUES ('$Cin', '$Nom', '$Prenom', '$Sexe', '$DNaissance', '$Adresse', '$Tel', '$E_Mail', 'Login', '$Motdepasse')"; 
    
    echo $requete;
    
    	    //$sql = mysql_query($requete, $cnx) or die( mysql_error() ) ;
    
          	  if (($Cin != "") && ($Nom != "")&& ($Prenom != "")&& ($Login != ""))
    		  {
          echo "Merci votre  inscription est confirm&eacute;!";
     
         exit;
     
             }
      ?>
    Tu verras tout de suite ce que vaut ta variable $requete. Tu exécutes ce qu'elle te retourne dans ton sgbd pour voir si ça fonctionne, et uniquement si ça fonctionne, tu décommentes ton mysql_query.
    Si ton labeur est dur et que tes résultats sont minces, rappelles-toi qu'un jour, le grand chêne a été un gland comme toi !

  8. #8
    Futur Membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Mars 2009
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2009
    Messages : 9
    Points : 7
    Points
    7
    Par défaut meme prob
    c'est le meme probleme il affiche le requette seulement et la table et vide.

Discussions similaires

  1. [MVC] [Débutant] Problème de formulaire
    Par Marneus dans le forum Spring Web
    Réponses: 2
    Dernier message: 07/08/2009, 17h06
  2. Débutant: Problème sous formulaire
    Par jrogron dans le forum Access
    Réponses: 14
    Dernier message: 03/08/2006, 20h26
  3. problème traitement formulaire cgi(débutant)
    Par Shyboy dans le forum Web
    Réponses: 13
    Dernier message: 02/07/2006, 18h17
  4. [débutant]problème de formulaire
    Par maitreblitosaure dans le forum IHM
    Réponses: 4
    Dernier message: 12/06/2006, 14h05
  5. [débutant]petit problème sur formulaire avec onglets
    Par Christophe93250 dans le forum Access
    Réponses: 2
    Dernier message: 06/01/2006, 10h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo