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 :

Erreur de soumission d'un formulaire


Sujet :

Langage PHP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2005
    Messages
    148
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2005
    Messages : 148
    Points : 55
    Points
    55
    Par défaut Erreur de soumission d'un formulaire
    Bonjour tout le monde!

    J'ai un petit problème avec mon formulaire. voici le code de ma page :
    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
    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
     
    <?
    session_start(); 
    include("database.php");
     
    import_request_variables("P","form1_");
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<a href="http://www.w3.org/TR/html4/loose.dtd" target="_blank">http://www.w3.org/TR/html4/loose.dtd</a>">
    <html>
    <head>
    <script language="javascript">
     
    function afficher1() {
     document.getElementById("PAY").style.visibility='visible';   
     }
     function cacher2() {
     document.getElementById("PAY").style.visibility='hidden'; 
     }
     
     function cacher3() {
     document.getElementById("dipl").style.visibility='hidden'; 
     }
     function afficher3() {
     document.getElementById("dipl").style.visibility='visible';  
     }
     
    </script>
    <title>Informations Personnelles</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    .style1 {font-size: xx-large}
    body {
        background-image: url(images/fond_index.jpg);
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-position: center top;
        display: list-item;    
    }
    -->
    </style>
    <link href="background%20style.css" rel="stylesheet" type="text/css">
    </head>
     
    <body >
    <h1 align="center"> </h1>
    <h1 align="center"><strong><span class="style1">INFORMATIONS PERSONNELLES</span></strong></h1>
    <p align="center"> </p>
    <form action="traitement1.php" method="post" name="form1">
     
      <div align="center">
        <table width="504" border="0" align="center">
          <tr bordercolor="" bgcolor="">
            <td align="left" ><strong>Civilit&eacute; : </strong></td>
            <td width="306" align="left" background="Drag to a file to choose it."><select name="CIV" id="CIV">
                <option value="1">Mlle</option>
                <option value="2">Mme</option>
                <option value="3">Mr</option>
                <option value="0">civilit&eacute;</option>
            </select></td>
          </tr>
          <tr bordercolor="" bgcolor="">
            <td align="left" background="Drag to a file to choose it."><strong>Nom : </strong></td>
            <td align="left" background="Drag to a file to choose it.">
              <input name="nom" type="text" id="nom"></td>
          </tr>
          <tr bordercolor="" bgcolor="">
            <td align="left" background="Drag to a file to choose it."><strong>Pr&eacute;nom :</strong></td>
            <td align="left" background="Drag to a file to choose it."><input name="prenom" type="text" id="prenom"></td>
          </tr>
          <tr bordercolor="" bgcolor="">
            <td align="left" background="Drag to a file to choose it."><strong>Date de naissance : </strong></td>
            <td align="left" background="Drag to a file to choose it."><input name="date" type="text" id="date"></td>
          </tr>
          <tr bordercolor="" bgcolor="">
            <td align="left" background="Drag to a file to choose it."><strong>Email : </strong></td>
            <td align="left" background="Drag to a file to choose it."><input name="email" type="text" id="email" size="50"></td>
          </tr>
          <tr bordercolor="" bgcolor="">
            <td align="left" background="Drag to a file to choose it." bgcolor=""><strong>Promotion ESSTIN : </strong></td>
            <td align="left" background="Drag to a file to choose it."><select name="PRO" id="PRO">
                <option selected>Promotion</option>
                <option value="1">1965</option>
                <option value="2">1966</option>
     
                                       </select></td>
          </tr>
        </table>
        <p> </p>
        <table width="506" border="0" align="center" id="t2">
          <tr align="left" bordercolor="">
            <td colspan="2" background="Drag to a file to choose it."><strong>Quand as-tu int&eacute;gr&eacute; l'ESSTIN ? </strong></td>
          </tr>
          <tr align="left" bordercolor="">
            <td colspan="2" background="Drag to a file to choose it."><p>
                 <label>
                 <input type="radio" name="ENT" value="1">
            1A</label>
                 <br>
                 <label>
                 <input type="radio" name="ENT" value="3">
            3A </label>
                 <br>
                 <label>
                 <input type="radio" name="ENT" value="4">
            4A</label>
                 <br>
            </p></td>
          </tr>
          <tr align="left" bordercolor="">
            <td colspan="2" background="Drag to a file to choose it."><strong>As-tu pass&eacute; un s&eacute;jour &agrave; l'&eacute;tranger ? </strong></td>
          </tr>
          <tr align="left" bordercolor="">
            <td width="65" height="26" bordercolor="#000000" background="Drag to a file to choose it.">
                <div align="left">
                  <p>
                    <label>
                    <input type="radio" name="ON1" value="1" onClick="afficher1()">
      Oui</label>
                    <br>
                    <label>
                    <input type="radio" name="ON1" value="0" onClick="cacher2()">
      Non</label>
                    <br>
                  </p>
    </div></td>
            <td width="385" bordercolor="#000000" background="Drag to a file to choose it."><font size="-1">
               <select name="PAY" id="PAY" style="visibility:hidden" >
                 <option value="" selected> Tous les pays</option>
                 <option value="countryAR"> Argentina</option>
                 <option value="countryAM"> Armenia</option>
     
              </select>
            </font></td>
          </tr>
        </table>
        <table width="506" height="118" border="0" align="center">
          <tr>
            <td height="21" colspan="2" align="left"><p><strong>Quelle option de fin d'&eacute;tude avais-tu suivi ? </strong></p></td>
          </tr>
          <tr>
            <td height="26" colspan="2" align="left"><p id="OPT" name="OPT" size="1">
                <select name="OPT" size="1" id="OPT">
                  <option value="1">IE</option>
                  <option value="2">MS</option>
                  <option value="3">MFE</option>
                  <option value="4">TM</option>
                  <option value="5">AUTO</option>
                  <option value="6">MAINTENANCE</option>
                  <option value="7">IRS</option>
                  <option selected>Option</option>
                </select>
                  </p></td>
          </tr>
          <tr>
            <td height="21" colspan="2" align="left"><p align="left"><strong>As-tu d'autres dipl&ocirc;mes ? </strong></p></td>
          </tr>
          <tr>
            <td width="66" height="40" align="left"><div align="left">
              <p>
                  <label>
                  <input type="radio" name="DIP" value="1" onClick="afficher3()">
              Oui</label>
                  <br>
                  <label>
                  <input type="radio" name="DIP" value="0" onClick="cacher3()">
              Non</label>
              </p>
            </div>          </td>
            <td width="430" height="40" align="left"><textarea name="dipl" id="dipl" style="visibility:hidden"></textarea></td>
          </tr>
        </table>
      </div>
      <p align="center">
        <input name="ps1" type="submit" class="Bouttons" id="ps1"  value="Page suivante" >
    </p>
    </form>
     <? echo"<a href=\"logout.php\">Logout</a>";
     if (isset($_POST['CIV']) &&  isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['date']) && isset($_POST['email']) && isset($_POST['PRO']) && isset($_POST['ENT']) && isset($_POST['ON1']) && isset($_POST['PAY']) && isset($_POST['OPT']) && isset($_POST['DIP']) && isset($_POST['dipl']))
    {
        $_SESSION['CIV'] = $_POST["CIV"];
       $_SESSION['nom'] = $_POST["nom"];
       $_SESSION['prenom'] = $_POST["prenom"];
       $_SESSION['date'] = $_POST["date"];
       $_SESSION['email'] = $_POST["email"];
       $_SESSION['PRO'] = $_POST["PRO"];
       $_SESSION['ENT'] = $_POST["ENT"];
       $_SESSION['ON1'] = $_POST["ON1"];
       $_SESSION['PAY'] = $_POST["PAY"];
       $_SESSION['OPT'] = $_POST["OPT"];
       $_SESSION['DIP'] = $_POST["DIP"];
       $_SESSION['dipl'] = $_POST["dipl"];      
       } 
       else {
         var_dump($_POST);
         die('Erreur à la soumission du formulaire');
    }
       ?>
    </body></html>
    le traitement de cette page se fait sur une autre page :
    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
     
    <? 
    /* Include Files *********************/
    session_start();
    include("database.php");
     
    /*************************************/
    ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<a href="http://www.w3.org/TR/html4/loose.dtd" target="_blank">http://www.w3.org/TR/html4/loose.dtd</a>">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <?
     
    function transfer1(){
       global $conn;
       echo $q = "UPDATE 'utilisateur' SET civ='".$_SESSION['CIV']."', nom='".$_SESSION['nom']."', prenom='".$_SESSION['prenom']."', date='".$_SESSION['date']."', email='".$_SESSION['email']."', pro = '".$_SESSION['PRO']."', ent= '".$_SESSION['ENT']."', on1 = '".$_SESSION['ON1']."', pay = '".$_SESSION['PAY']."', opt = '".$_SESSION['OPT']."', dip= '".$_SESSION['DIP']."', dipl = '".$_SESSION['dipl']."' WHERE user='yassinej' ";
       return mysql_query($q,$conn);
    }
     
    transfer1();
    ?> 
    <p align="center"><strong>TRAITEMENT DES DONNEES EN COURS....</strong></p>
    </body>
    </html>
    sur la page Form1.php j'ai une erreur du type : erreur de soumission du formulaire...
    je ne sais pas ce qui cloche..?
    merci

  2. #2
    Expert éminent
    Avatar de Swoög
    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    6 045
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 6 045
    Points : 8 339
    Points
    8 339
    Par défaut


    la vérification des données (le if avec les isset) ça se met sur la page de traitement...

    au début de ta fonction transfert...

    au fait : ça sert à rien de faire une fonction pour ça...
    Rédacteur "éclectique" (XML, Cours PHP, Cours JavaScript, IRC, Web...)
    Les Règles du Forum - Mon Site Web sur DVP.com (Développement Web, PHP, (X)HTML/CSS, SQL, XML, IRC)
    je ne répondrai à aucune question technique via MP, MSN ou Skype : les Forums sont là pour ça !!! Merci de me demander avant de m'ajouter à vos contacts sinon je bloque !
    pensez à la balise [ code ] (bouton #) et au tag (en bas)

Discussions similaires

  1. Réponses: 6
    Dernier message: 24/04/2013, 17h14
  2. Erreur à la soumission d'un formulaire
    Par Shanna666 dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 20/06/2012, 11h15
  3. Formulaire de contact : erreur aprés soumission
    Par Erwan31 dans le forum Langage
    Réponses: 13
    Dernier message: 21/09/2009, 18h47
  4. Erreur 404 lors de la soumission d'un formulaire
    Par brunodim dans le forum Langage
    Réponses: 5
    Dernier message: 05/06/2007, 16h34
  5. [JSP]Problème de double soumission d'un formulaire
    Par jgfa9 dans le forum Servlets/JSP
    Réponses: 31
    Dernier message: 24/08/2005, 11h54

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