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 :

[Dates] récuperer une date Fr , l'enregistrer en anglais.


Sujet :

Langage PHP

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut [Dates] récuperer une date Fr , l'enregistrer en anglais.
    Bonjour à tous...
    j'aimerais insérer une date en francais(plus facile) dans un formulaire (PHP).jusque la, pas de soucis...
    En cliquant pour enregistrer ce formulaire dans une BDD Mysql, j'aimerai modifier cette date pour qu'elle se retrouve au format anglais(be vi, sans ca, ca ne marche pas!)
    Pour la modifier, pas de problème, je fais ceci....
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <?
    $dateFr = "24/04/2007"
    list($jour, $mois, $annee) = explode("/",$dateFr);
    $array = array($annee,$mois,$jour);
    $dateFr = implode("-",$array);
    echo $dateEn;
    ?>
    Mon problème est que je ne sais pas comment récuperer la date insérée dans mon formulaire...

    Je sais que ca parait stupide, mais je ne trouve cela nulle part...
    Merci pour votre aide...

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Avril 2006
    Messages : 15
    Par défaut
    Il faudrait qu'on voit ton formulaire HTML histoire qu'on sache de quelle façon tu saisis la date. ^^

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <th scope="row"><div align="right">Date de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DateMission">
                  <em> (respectez le format &quot;jj/mm/yyyy&quot;)</em></div></td>

    Voici le code du formulaire...

    Ps:Merci de ton aide...

  4. #4
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Par défaut
    Salut
    C'est un bout du code de ton formulaire ou le code en entier ? Quelle action utilises-tu et quelle méthode ? Et le script de récupération de la date et le formualire sont-ils dans la même page ou dans 2 pages différentes ?

    Je sais, ça fait beaucoup de questions, mais ça nous permettra de mieux t'aider

    au fait (le bouton # dans l'éditeur de post)
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    Oui, tu as raison, voici donc ma page en entier...
    Il s'agit d'un formulaire de demande de véhicule...
    Le demandeur doit remplir les champ...
    Je m'attaque pour l'instant au champ "date de la mission".
    Le demandeur doit insérer la date la mission...
    En cliquant sur le bouton, les données s'enregistrent dans la BDD...

    Et donc, j'aimerais enregistrer la date que le demandeur aura inséré au format fr dans la bdd au format anglais...


    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
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
     
    <?php require_once('../Connections/ConnexionTransport.php'); ?>
    <?php
    if (!isset($_SESSION)) {
      session_start();
    }
    $MM_authorizedUsers = "User,Admin";
    $MM_donotCheckaccess = "false";
     
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
      // For security, start by assuming the visitor is NOT authorized. 
      $isValid = False; 
     
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      if (!empty($UserName)) { 
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        $arrUsers = Explode(",", $strUsers); 
        $arrGroups = Explode(",", $strGroups); 
        if (in_array($UserName, $arrUsers)) { 
          $isValid = true; 
        } 
        // Or, you may restrict access to only certain users based on their username. 
        if (in_array($UserGroup, $arrGroups)) { 
          $isValid = true; 
        } 
        if (($strUsers == "") && false) { 
          $isValid = true; 
        } 
      } 
      return $isValid; 
    }
     
    $MM_restrictGoTo = "../Index.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo); 
      exit;
    }
    ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
     
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
     
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
     
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO demandetransport (UserLogin, DateDemande, TimeDemande, DateMission, DureeMission, SvDemandeur, DestinationMission, ViaMission, PcDate, PcHeure, PcLieu, DenominationMission, ValidationMission) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['UserLogin'], "text"),
                           GetSQLValueString($_POST['DateDemande'], "text"),
                           GetSQLValueString($_POST['TimeDemande'], "text"),
                           GetSQLValueString($_POST['DateMission'], "text"),
                           GetSQLValueString($_POST['DureeMission'], "text"),
                           GetSQLValueString($_POST['SvDemandeur'], "text"),
                           GetSQLValueString($_POST['DestinationMission'], "text"),
                           GetSQLValueString($_POST['ViaMission'], "text"),
                           GetSQLValueString($_POST['PcDate'], "text"),
                           GetSQLValueString($_POST['PcHeure'], "text"),
                           GetSQLValueString($_POST['PcLieu'], "text"),
                           GetSQLValueString($_POST['DenominationMission'], "text"),
    					   GetSQLValueString($_POST['ValidationMission'], "text"));
     
      mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
      $Result1 = mysql_query($insertSQL, $ConnexionTransport) or die(mysql_error());
    	$IdDemandeActuelle = mysql_insert_id();
      $insertGoTo = "DemandeDeTransportVehicule.php?recordIDDemande=".$IdDemandeActuelle;
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
     
    $colname_rsUser = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_rsUser = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
    $query_rsUser = sprintf("SELECT * FROM `user` WHERE UserLogin = '%s'", $colname_rsUser);
    $rsUser = mysql_query($query_rsUser, $ConnexionTransport) or die(mysql_error());
    $row_rsUser = mysql_fetch_assoc($rsUser);
    $totalRows_rsUser = mysql_num_rows($rsUser);
    ?>
    <html>
    <head>
    <title>Demande de transport</title>
    </head>
    <body>
    <table width="100%" cellpadding="" cellspacing="" bordercolor="#676767" bgcolor="#FFFFFF">
      <tr>
        <th bordercolor="#676767" scope="row"><div align="left"><img src="/transport/Pictures/Logo.jpg" width="350" height="100"></div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" bgcolor="#999999" scope="row"><span class="Style4"><a href="Acceuil.php">Acceuil</a> | <a href="DemandeDeTransport.php">Demande de transport</a> | <a href="InfoPerso.php">Donn&eacute;es personnelles</a> | <a href="Listing.php?recordIDDate=<? echo date('d/m/Y')?>">Listing</a> | <a href="../Administrateur/Acceuil.php">Admin</a> </span></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row"><div align="center">
          <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
            <table width="800" border="0" cellspacing="2" cellpadding="2">
              <tr>
                <th width="402" scope="row">&nbsp;</th>
                <td width="384"><p>
                  <input type="hidden" name="DateDemande" value="<? echo date(); ?>"><input type="hidden" name="TimeDemande" value="">
                  <input type="hidden" name="ValidationMission" value="En attente">
                </p>              </td>
              </tr>
              <tr>
                <th scope="row"><div align="right">D&eacute;nomination de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DenominationMission">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Demande effectu&eacute;e par : </div></th>
                <td><div align="left"><?php echo $row_rsUser['UserRank']; ?> <?php echo $row_rsUser['UserNom']; ?>
                  <input type="hidden" name="UserLogin" value="<?php echo $row_rsUser['UserLogin']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Service demandeur: </div></th>
                <td><div align="left">
                  <input name="SvDemandeur" type="text" value="<?php echo $row_rsUser['UserService']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Date de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DateMission">
                  <em> (respectez le format &quot;jj/mm/yyyy&quot;)</em></div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Dur&eacute;e de la mission: </div></th>
                <td><input name="DureeMission" type="text" size="5">
                  <em>Jour(s).</em></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Destination de la mission: </div></th>
                <td><input type="text" name="DestinationMission"></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">D&eacute;tail du trajet (via...): </div></td>
                <td><textarea name="ViaMission" cols="40" rows="3"></textarea></td>
              </tr>
     
     
              <tr>
                <th scope="row"><div align="right">Date de Prise en Charge des v&eacute;hicules: </div></th>
                <td><input type="text" name="PcDate">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Heure de prise en charge: </div></td>
                <td><input type="text" name="PcHeure">
                  <em>(respectez le format &quot;HH.MM&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Endroit de prise en charge: </div></td>
                <td><input type="text" name="PcLieu"></td>
              </tr>
              <tr>
                <th scope="row"><div align="right"></div></th>
                <td><div align="right">
                  <input type="submit" name="Submit" value="Suivant&gt;&gt;">
                </div></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1">
            <input type="hidden" name="MM_insert" value="form1">
          </form>
          </div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center">&copy;S4-Mat</div></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center"></div></td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($rsUser);
    ?>

  6. #6
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Par défaut
    Ok, c'est plus complet comme ça merci.

    Tout d'abord j'ai un doute sur ta balise form, mais je suppose que $_SERVER['PHP_SELF'] renvoie une url.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    $editFormAction = $_SERVER['PHP_SELF'];
    ...
    <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
    Pour en revenir au problème, comme tu récupères les variables de ton formulaire par une methode post, tu peux récupérer DateMission par $_POST['DateMission'].
    Et si j'ai bien compris, tu veux d'abord la convertir, puis l'insérer dans la bdd une fois convertie au bon format. Dans ce cas, écris une petite fonction qui réalise le bout de script de ton premier post et insère le résultat dans ta requête.
    (je suis pas si je suis très claire là )
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    ok... tout cela est trés logique... je fais ca, mais... est-ce valable?
    et comment insérer cela dans ma table... en meme temps que les autres données bien sur...
    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
    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
    <?php require_once('../Connections/ConnexionTransport.php'); ?>
    <?php
    if (!isset($_SESSION)) {
      session_start();
    }
    $MM_authorizedUsers = "User,Admin";
    $MM_donotCheckaccess = "false";
    
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
      // For security, start by assuming the visitor is NOT authorized. 
      $isValid = False; 
    
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      if (!empty($UserName)) { 
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        $arrUsers = Explode(",", $strUsers); 
        $arrGroups = Explode(",", $strGroups); 
        if (in_array($UserName, $arrUsers)) { 
          $isValid = true; 
        } 
        // Or, you may restrict access to only certain users based on their username. 
        if (in_array($UserGroup, $arrGroups)) { 
          $isValid = true; 
        } 
        if (($strUsers == "") && false) { 
          $isValid = true; 
        } 
      } 
      return $isValid; 
    }
    
    $MM_restrictGoTo = "../Index.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo); 
      exit;
    }
    ?>
    <? 
    				$dateFr = $_POST['DateMission'];
    				list($jour, $mois, $annee) = explode("/",$dateFr);
    				$array = array($annee,$mois,$jour);
    				$dateEn = implode("-",$array);
    				?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO demandetransport (UserLogin, DateDemande, TimeDemande, DateMission, DureeMission, SvDemandeur, DestinationMission, ViaMission, PcDate, PcHeure, PcLieu, DenominationMission, ValidationMission) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['UserLogin'], "text"),
                           GetSQLValueString($_POST['DateDemande'], "text"),
                           GetSQLValueString($_POST['TimeDemande'], "text"),
                           GetSQLValueString($_POST['DateMission'], "text"),
                           GetSQLValueString($_POST['DureeMission'], "text"),
                           GetSQLValueString($_POST['SvDemandeur'], "text"),
                           GetSQLValueString($_POST['DestinationMission'], "text"),
                           GetSQLValueString($_POST['ViaMission'], "text"),
                           GetSQLValueString($_POST['PcDate'], "text"),
                           GetSQLValueString($_POST['PcHeure'], "text"),
                           GetSQLValueString($_POST['PcLieu'], "text"),
                           GetSQLValueString($_POST['DenominationMission'], "text"),
    					   GetSQLValueString($_POST['ValidationMission'], "text"));
    
      mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
      $Result1 = mysql_query($insertSQL, $ConnexionTransport) or die(mysql_error());
    	$IdDemandeActuelle = mysql_insert_id();
      $insertGoTo = "DemandeDeTransportVehicule.php?recordIDDemande=".$IdDemandeActuelle;
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    
    $colname_rsUser = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_rsUser = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
    $query_rsUser = sprintf("SELECT * FROM `user` WHERE UserLogin = '%s'", $colname_rsUser);
    $rsUser = mysql_query($query_rsUser, $ConnexionTransport) or die(mysql_error());
    $row_rsUser = mysql_fetch_assoc($rsUser);
    $totalRows_rsUser = mysql_num_rows($rsUser);
    ?>
    <html>
    <head>
    <title>Demande de transport</title>
    </head>
    <body>
    <table width="100%" cellpadding="" cellspacing="" bordercolor="#676767" bgcolor="#FFFFFF">
      <tr>
        <th bordercolor="#676767" scope="row"><div align="left"><img src="/transport/Pictures/Logo.jpg" width="350" height="100"></div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" bgcolor="#999999" scope="row"><span class="Style4"><a href="Acceuil.php">Acceuil</a> | <a href="DemandeDeTransport.php">Demande de transport</a> | <a href="InfoPerso.php">Donn&eacute;es personnelles</a> | <a href="Listing.php?recordIDDate=<? echo date('d/m/Y')?>">Listing</a> | <a href="../Administrateur/Acceuil.php">Admin</a> </span></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row"><div align="center">
          <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
            <table width="800" border="0" cellspacing="2" cellpadding="2">
              <tr>
                <th width="402" scope="row">&nbsp;</th>
                <td width="384"><p>
                  <input type="hidden" name="DateDemande" value="<? echo date('Y-m-d'); ?>"><input type="hidden" name="TimeDemande" value="<? echo date('H:i')?>">
                  <input type="hidden" name="ValidationMission" value="En attente">
                </p>              </td>
              </tr>
              <tr>
                <th scope="row"><div align="right">D&eacute;nomination de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DenominationMission">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Demande effectu&eacute;e par : </div></th>
                <td><div align="left"><?php echo $row_rsUser['UserRank']; ?> <?php echo $row_rsUser['UserNom']; ?>
                  <input type="hidden" name="UserLogin" value="<?php echo $row_rsUser['UserLogin']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Service demandeur: </div></th>
                <td><div align="left">
                  <input name="SvDemandeur" type="text" value="<?php echo $row_rsUser['UserService']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Date de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DateMission">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Dur&eacute;e de la mission: </div></th>
                <td><input name="DureeMission" type="text" size="5">
                  <em>Jour(s).</em></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Destination de la mission: </div></th>
                <td><input type="text" name="DestinationMission"></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">D&eacute;tail du trajet (via...): </div></td>
                <td><textarea name="ViaMission" cols="40" rows="3"></textarea></td>
              </tr>
              
              
              <tr>
                <th scope="row"><div align="right">Date de Prise en Charge des v&eacute;hicules: </div></th>
                <td><input type="text" name="PcDate">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Heure de prise en charge: </div></td>
                <td><input type="text" name="PcHeure">
                  <em>(respectez le format &quot;HH.MM&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Endroit de prise en charge: </div></td>
                <td><input type="text" name="PcLieu"></td>
              </tr>
              <tr>
                <th scope="row"><div align="right"></div></th>
                <td><div align="right">
                  <input type="submit" name="Submit" value="Suivant&gt;&gt;">
                </div></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1">
            <input type="hidden" name="MM_insert" value="form1">
          </form>
          </div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center">&copy;S4-Mat</div></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center"></div></td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($rsUser);
    ?>

  8. #8
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Par défaut
    Je te propose plutot de faire ça comme ça :

    Créer la function au début de la page
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    function conversion($datefr){
      list($jour, $mois, $annee) = explode("/",$dateFr);
      $array = array($annee,$mois,$jour);
      $dateFr = implode("-",$array);
      return $dateEn;
    }
    Puis utiliser cette fonction pour récupérer le bon format de la date et l'insérer dans la base de données:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $dateM = conversion($_POST['DateMission']);
    avec une requête de ce genre :
    Code requete : Sélectionner tout - Visualiser dans une fenêtre à part
    INSERT INTO demande(DateMission) VALUES $dateM
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

  9. #9
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    je jette l'éponge ce soir... je m'y remet dés demain matin, et viens te tenir au courant de mes progrés...
    Encore un grand merci pour ton aide précieuse....
    (ba vi, suis encore un débutant moi lol...)

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    Bonjour…
    Bon, ben, après de multiples essais, j’ai toujours ce message d’erreur…
    Pourtant, j’ai l’impression d’avoir bien défini cette variable..

    Notice: Undefined variable: dateFr in c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php on line 49

    Notice: Undefined offset: 2 in c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php on line 49

    Notice: Undefined offset: 1 in c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php on line 49

    Warning: Missing argument 2 for getsqlvaluestring() in c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php on line 57
    Erreur de syntaxe près de ' '1', 'EMS-S4 Mat', 'LeopoldBurgs', 'Rocourt', '25/04/2007', '08' à la ligne 1


    Voici le code

    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
    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
     
    <?php require_once('../Connections/ConnexionTransport.php'); ?>
    <?php
    if (!isset($_SESSION)) {
      session_start();
    }
    $MM_authorizedUsers = "User,Admin";
    $MM_donotCheckaccess = "false";
     
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
      // For security, start by assuming the visitor is NOT authorized. 
      $isValid = False; 
     
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      if (!empty($UserName)) { 
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        $arrUsers = Explode(",", $strUsers); 
        $arrGroups = Explode(",", $strGroups); 
        if (in_array($UserName, $arrUsers)) { 
          $isValid = true; 
        } 
        // Or, you may restrict access to only certain users based on their username. 
        if (in_array($UserGroup, $arrGroups)) { 
          $isValid = true; 
        } 
        if (($strUsers == "") && false) { 
          $isValid = true; 
        } 
      } 
      return $isValid; 
    }
     
    $MM_restrictGoTo = "../Index.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo); 
      exit;
    }
    ?>
    <? 
    				function conversion($datefr){
      list($jour, $mois, $annee) = explode("/",$dateFr);
      $array = array($annee,$mois,$jour);
      $dateEn = implode("-",$array);
      return $dateEn;
    }
     
    				?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
     
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
     
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
     
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $dateM = conversion($_POST['DateMission']);
      $insertSQL = sprintf("INSERT INTO demandetransport (UserLogin, DateDemande, TimeDemande, DateMission, DureeMission, SvDemandeur, DestinationMission, ViaMission, PcDate, PcHeure, PcLieu, DenominationMission, ValidationMission) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['UserLogin'], "text"),
                           GetSQLValueString($_POST['DateDemande'], "text"),
                           GetSQLValueString($_POST['TimeDemande'], "text"),
                           GetSQLValueString($dateM),
                           GetSQLValueString($_POST['DureeMission'], "text"),
                           GetSQLValueString($_POST['SvDemandeur'], "text"),
                           GetSQLValueString($_POST['DestinationMission'], "text"),
                           GetSQLValueString($_POST['ViaMission'], "text"),
                           GetSQLValueString($_POST['PcDate'], "text"),
                           GetSQLValueString($_POST['PcHeure'], "text"),
                           GetSQLValueString($_POST['PcLieu'], "text"),
                           GetSQLValueString($_POST['DenominationMission'], "text"),
    					   GetSQLValueString($_POST['ValidationMission'], "text"));
     
     
      mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
      $Result1 = mysql_query($insertSQL, $ConnexionTransport) or die(mysql_error());
      $IdDemandeActuelle = mysql_insert_id();
      $insertGoTo = "DemandeDeTransportVehicule.php?recordIDDemande=".$IdDemandeActuelle;
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
     
    $colname_rsUser = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_rsUser = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
    $query_rsUser = sprintf("SELECT * FROM `user` WHERE UserLogin = '%s'", $colname_rsUser);
    $rsUser = mysql_query($query_rsUser, $ConnexionTransport) or die(mysql_error());
    $row_rsUser = mysql_fetch_assoc($rsUser);
    $totalRows_rsUser = mysql_num_rows($rsUser);
    ?>
    <html>
    <head>
    <title>Demande de transport</title>
    </head>
    <body>
    <table width="100%" cellpadding="" cellspacing="" bordercolor="#676767" bgcolor="#FFFFFF">
      <tr>
        <th bordercolor="#676767" scope="row"><div align="left"><img src="/transport/Pictures/Logo.jpg" width="350" height="100"></div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" bgcolor="#999999" scope="row"><span class="Style4"><a href="Acceuil.php">Acceuil</a> | <a href="DemandeDeTransport.php">Demande de transport</a> | <a href="InfoPerso.php">Donn&eacute;es personnelles</a> | <a href="Listing.php?recordIDDate=<? echo date('d/m/Y')?>">Listing</a> | <a href="../Administrateur/Acceuil.php">Admin</a> </span></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row"><div align="center">
          <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
            <table width="800" border="0" cellspacing="2" cellpadding="2">
              <tr>
                <th width="402" scope="row">&nbsp;</th>
                <td width="384"><p>
                  <input type="hidden" name="DateDemande" value="<? echo date('Y-m-d'); ?>"><input type="hidden" name="TimeDemande" value="<? echo date('H:i')?>">
                  <input type="hidden" name="ValidationMission" value="En attente">
                </p>              </td>
              </tr>
              <tr>
                <th scope="row"><div align="right">D&eacute;nomination de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DenominationMission">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Demande effectu&eacute;e par : </div></th>
                <td><div align="left"><?php echo $row_rsUser['UserRank']; ?> <?php echo $row_rsUser['UserNom']; ?>
                  <input type="hidden" name="UserLogin" value="<?php echo $row_rsUser['UserLogin']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Service demandeur: </div></th>
                <td><div align="left">
                  <input name="SvDemandeur" type="text" value="<?php echo $row_rsUser['UserService']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Date de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DateMission">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Dur&eacute;e de la mission: </div></th>
                <td><input name="DureeMission" type="text" size="5">
                  <em>Jour(s).</em></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Destination de la mission: </div></th>
                <td><input type="text" name="DestinationMission"></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">D&eacute;tail du trajet (via...): </div></td>
                <td><textarea name="ViaMission" cols="40" rows="3"></textarea></td>
              </tr>
     
     
              <tr>
                <th scope="row"><div align="right">Date de Prise en Charge des v&eacute;hicules: </div></th>
                <td><input type="text" name="PcDate">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Heure de prise en charge: </div></td>
                <td><input type="text" name="PcHeure">
                  <em>(respectez le format &quot;HH.MM&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Endroit de prise en charge: </div></td>
                <td><input type="text" name="PcLieu"></td>
              </tr>
              <tr>
                <th scope="row"><div align="right"></div></th>
                <td><div align="right">
                  <input type="submit" name="Submit" value="Suivant&gt;&gt;">
                </div></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1">
            <input type="hidden" name="MM_insert" value="form1">
          </form>
          </div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center">&copy;S4-Mat</div></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center"></div></td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($rsUser);
    ?>

  11. #11
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Par défaut
    Désolée, cette erreur-là vient de la fonction que je t'ai donné et qui contient une faute de syntaxe php est sensible à la casse... et en plus il y a une autre faute. Je suis vraiment pas douée...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    function conversion($dateFr){ // et pas conversion(datefr)
      list($jour, $mois, $annee) = explode("/",$dateFr);
      $array = array($annee,$mois,$jour);
      $dateEn = implode("-",$array); // et pas $dateFr = implode("-",$array); 
      return $dateEn;
    }
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

  12. #12
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    Pas douée, tu veux rire ou quoi... je débute, et je peux te dire que si j'avais tes connaissance, je serais déjà un homme heureux...
    Bref, j'ai modifié ça... mais j'ai toujours une erreur...
    Apparement, j’ai du oublier quelquechose, ou je n'ai pas placé mes billes au bon endroit...

    Voici l'erreur:
    Warning: Missing argument 2 for getsqlvaluestring() in c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php on line 57

    Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php:57) in c:\program files\easyphp1-8\www\transport\utilisateur\demandedetransport.php on line 113
    et voici le code modifié:
    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
    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
    <?php require_once('../Connections/ConnexionTransport.php'); ?>
    <?php
    if (!isset($_SESSION)) {
      session_start();
    }
    $MM_authorizedUsers = "User,Admin";
    $MM_donotCheckaccess = "false";
     
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
      // For security, start by assuming the visitor is NOT authorized. 
      $isValid = False; 
     
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
      // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
      if (!empty($UserName)) { 
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
        // Parse the strings into arrays. 
        $arrUsers = Explode(",", $strUsers); 
        $arrGroups = Explode(",", $strGroups); 
        if (in_array($UserName, $arrUsers)) { 
          $isValid = true; 
        } 
        // Or, you may restrict access to only certain users based on their username. 
        if (in_array($UserGroup, $arrGroups)) { 
          $isValid = true; 
        } 
        if (($strUsers == "") && false) { 
          $isValid = true; 
        } 
      } 
      return $isValid; 
    }
     
    $MM_restrictGoTo = "../Index.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo); 
      exit;
    }
    ?>
    <? 
    				function conversion($dateFr){
      list($jour, $mois, $annee) = explode("/",$dateFr);
      $array = array($annee,$mois,$jour);
      $dateEn = implode("-",$array);
      return $dateEn;
    }
     
    				?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
     
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
     
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
     
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $dateM = conversion($_POST['DateMission']);
      $insertSQL = sprintf("INSERT INTO demandetransport (UserLogin, DateDemande, TimeDemande, DateMission, DureeMission, SvDemandeur, DestinationMission, ViaMission, PcDate, PcHeure, PcLieu, DenominationMission, ValidationMission) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['UserLogin'], "text"),
                           GetSQLValueString($_POST['DateDemande'], "text"),
                           GetSQLValueString($_POST['TimeDemande'], "text"),
                           GetSQLValueString($dateM),
                           GetSQLValueString($_POST['DureeMission'], "text"),
                           GetSQLValueString($_POST['SvDemandeur'], "text"),
                           GetSQLValueString($_POST['DestinationMission'], "text"),
                           GetSQLValueString($_POST['ViaMission'], "text"),
                           GetSQLValueString($_POST['PcDate'], "text"),
                           GetSQLValueString($_POST['PcHeure'], "text"),
                           GetSQLValueString($_POST['PcLieu'], "text"),
                           GetSQLValueString($_POST['DenominationMission'], "text"),
    					   GetSQLValueString($_POST['ValidationMission'], "text"));
     
     
      mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
      $Result1 = mysql_query($insertSQL, $ConnexionTransport) or die(mysql_error());
      $IdDemandeActuelle = mysql_insert_id();
      $insertGoTo = "DemandeDeTransportVehicule.php?recordIDDemande=".$IdDemandeActuelle;
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
     
    $colname_rsUser = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_rsUser = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
    }
    mysql_select_db($database_ConnexionTransport, $ConnexionTransport);
    $query_rsUser = sprintf("SELECT * FROM `user` WHERE UserLogin = '%s'", $colname_rsUser);
    $rsUser = mysql_query($query_rsUser, $ConnexionTransport) or die(mysql_error());
    $row_rsUser = mysql_fetch_assoc($rsUser);
    $totalRows_rsUser = mysql_num_rows($rsUser);
    ?>
    <html>
    <head>
    <title>Demande de transport</title>
    </head>
    <body>
    <table width="100%" cellpadding="" cellspacing="" bordercolor="#676767" bgcolor="#FFFFFF">
      <tr>
        <th bordercolor="#676767" scope="row"><div align="left"><img src="/transport/Pictures/Logo.jpg" width="350" height="100"></div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" bgcolor="#999999" scope="row"><span class="Style4"><a href="Acceuil.php">Acceuil</a> | <a href="DemandeDeTransport.php">Demande de transport</a> | <a href="InfoPerso.php">Donn&eacute;es personnelles</a> | <a href="Listing.php?recordIDDate=<? echo date('d/m/Y')?>">Listing</a> | <a href="../Administrateur/Acceuil.php">Admin</a> </span></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row"><div align="center">
          <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
            <table width="800" border="0" cellspacing="2" cellpadding="2">
              <tr>
                <th width="402" scope="row">&nbsp;</th>
                <td width="384"><p>
                  <input type="hidden" name="DateDemande" value="<? echo date('Y-m-d'); ?>"><input type="hidden" name="TimeDemande" value="<? echo date('H:i')?>">
                  <input type="hidden" name="ValidationMission" value="En attente">
                </p>              </td>
              </tr>
              <tr>
                <th scope="row"><div align="right">D&eacute;nomination de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DenominationMission">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Demande effectu&eacute;e par : </div></th>
                <td><div align="left"><?php echo $row_rsUser['UserRank']; ?> <?php echo $row_rsUser['UserNom']; ?>
                  <input type="hidden" name="UserLogin" value="<?php echo $row_rsUser['UserLogin']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Service demandeur: </div></th>
                <td><div align="left">
                  <input name="SvDemandeur" type="text" value="<?php echo $row_rsUser['UserService']; ?>">
                </div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Date de la mission: </div></th>
                <td><div align="left">
                  <input type="text" name="DateMission">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></div></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Dur&eacute;e de la mission: </div></th>
                <td><input name="DureeMission" type="text" size="5">
                  <em>Jour(s).</em></td>
              </tr>
              <tr>
                <th scope="row"><div align="right">Destination de la mission: </div></th>
                <td><input type="text" name="DestinationMission"></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">D&eacute;tail du trajet (via...): </div></td>
                <td><textarea name="ViaMission" cols="40" rows="3"></textarea></td>
              </tr>
     
     
              <tr>
                <th scope="row"><div align="right">Date de Prise en Charge des v&eacute;hicules: </div></th>
                <td><input type="text" name="PcDate">
                  <em>(respectez le format &quot;jj/mm/yyyy&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Heure de prise en charge: </div></td>
                <td><input type="text" name="PcHeure">
                  <em>(respectez le format &quot;HH.MM&quot;)</em></td>
              </tr>
              <tr>
                <td scope="row"><div align="right">Endroit de prise en charge: </div></td>
                <td><input type="text" name="PcLieu"></td>
              </tr>
              <tr>
                <th scope="row"><div align="right"></div></th>
                <td><div align="right">
                  <input type="submit" name="Submit" value="Suivant&gt;&gt;">
                </div></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1">
            <input type="hidden" name="MM_insert" value="form1">
          </form>
          </div></th>
      </tr>
      <tr>
        <th bordercolor="#FFFFFF" scope="row">&nbsp;</th>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center">&copy;S4-Mat</div></td>
      </tr>
      <tr>
        <td bordercolor="#FFFFFF" class="Style3" scope="row"><div align="center"></div></td>
      </tr>
    </table>
    </body>
    </html>
    <?php
    mysql_free_result($rsUser);
    ?>

  13. #13
    Membre expérimenté

    Profil pro
    Inscrit en
    Juin 2002
    Messages
    6 152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2002
    Messages : 6 152
    Par défaut
    Elle est là l'erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    GetSQLValueString($dateM),
    PHP attend le deuxième paramètre obligatoire à passer à la fonction (voir sa définition).

  14. #14
    Membre confirmé
    Profil pro
    Étudiant
    Inscrit en
    Mars 2006
    Messages
    70
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2006
    Messages : 70
    Par défaut
    Ben déjà la première erreur est simple, c'est juste que t'a oublié de mettre le 2e argument. C'est écrit pourtant (ok c'est de l'anglais)

    Par contre je ne comprends pas l'autre erreur (dsl)

  15. #15
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    100
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : Belgique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 100
    Par défaut
    Quel "grmsfcjfssmjfio"! Mais oui! c'est pas possible ça!!!! Décidement...
    Je me demandais de quel argument cette erreur parlait!
    Merci pour l'info...
    et un tout grand merci à toi aussi Celira pour ton aide...
    je clos le sujet...

    Un super grand merci à tous...

  16. #16
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Par défaut
    et un tout grand merci à toi aussi Celira pour ton aide...
    De rien !
    Et en ce qui concerne mes "connaissances", c'est 2h d'amphi magistral (où je n'ai pas écouté grand-chose ) sur le php alors que je n'avais jamais touché une ligne d'html avant le reste c'est de l'auto-formation avec des tutoriels comme ceux de dvp.com. Alors bon courage !
    Et n'oublie pas le bouton
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

Discussions similaires

  1. [DeskI XiR2] Comparaison d'une valeur à une date et à une date relative
    Par courti01 dans le forum Débuter
    Réponses: 1
    Dernier message: 07/11/2010, 21h39
  2. [5.1.4] Récuperer une date de l'invite
    Par EmmanuelleC dans le forum Débuter
    Réponses: 3
    Dernier message: 12/09/2008, 14h31
  3. Récuperer une date
    Par bov13 dans le forum VBScript
    Réponses: 5
    Dernier message: 03/10/2006, 17h20
  4. [Dates] Récuperer une date
    Par hutchuck dans le forum Langage
    Réponses: 2
    Dernier message: 30/11/2005, 18h52
  5. Comment récuperer une date depuis une chaine?
    Par shopoto dans le forum ASP
    Réponses: 4
    Dernier message: 12/05/2004, 16h17

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