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 :

plusieurs champs select formulaire


Sujet :

Langage PHP

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut plusieurs champs select formulaire
    j'ai un formulaire pour alimenter une table mysql , avec 3 select mais seul le dernier insere la valeur, comment puis je faire pour que les 3 selects insere les 3 valeurs envoyées les uns derriere les autres

    exemple valeur select 1 = toto1
    exemple valeur select 2 = toto2
    exemple valeur select 3 = toto3
    et dans la table ça doit insérer toto1toto2toto3




    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
    <th align="left" valign="top"  >1er lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th align="left" valign="top"  >2 em lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th align="left" valign="top"  >3 em lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
    merci

  2. #2
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Bonjour,

    Pourquoi les 3 ont les mêmes noms !!!!

    Tu prends 3 noms différents (search1, search2, search3) puis au retour du formulaire le champ = $_POST['search1'].$_POST['search2'].$_POST['search3'];

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    merci pour l'info j'ai renommé la valeur des champs en
    search_xtra1 , search_xtra2, et search_xtra3

    cependant je dois dire que le script a été fait ( par un autre à l'aide de webassist , une extension pour dreamweaver

    le code se présente ainsi

    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
    <?php 
     
    if (isset($_POST["Insert"])) // Trigger
    {
      $WA_connection = $liremessage;
      $WA_table = "search";
      $WA_sessionName = "WADA_Insert_search";
      $WA_redirectURL = "detail_lexique.php";
      $WA_keepQueryString = false;
      $WA_indexField = "search_id";
      $WA_fieldNamesStr = "search_nom|search_nom_uk|search_desc|search_xtra|search_doc_initiation|search_doc|search_site_blog|search_livre|search_forum|search_pub_partenaire_01|search_auteur|search_date";
      $WA_fieldValuesStr = "".((isset($_POST["search_nom"]))?$_POST["search_nom"]:"")  ."" . "|" . "".((isset($_POST["search_nom_uk"]))?$_POST["search_nom_uk"]:"")  ."" . "|" . "".((isset($_POST["search_desc"]))?$_POST["search_desc"]:"")  ."" . "|" . "".((isset($_POST["search_xtra"]))?$_POST["search_xtra"]:"")  ."" . "|" . "".((isset($_POST["search_doc_initiation"]))?$_POST["search_doc_initiation"]:"")  ."" . "|" . "".((isset($_POST["search_doc"]))?$_POST["search_doc"]:"")  ."" . "|" . "".((isset($_POST["search_site_blog"]))?$_POST["search_site_blog"]:"")  ."" . "|" . "".((isset($_POST["search_livre"]))?$_POST["search_livre"]:"")  ."" . "|" . "".((isset($_POST["search_forum"]))?$_POST["search_forum"]:"")  ."" . "|" . "".((isset($_POST["search_pub_partenaire_01"]))?$_POST["search_pub_partenaire_01"]:"")  ."" . "|" . "".((isset($_POST["search_auteur"]))?$_POST["search_auteur"]:"")  ."" . "|" . "".((isset($_POST["search_date"]))?$_POST["search_date"]:"")  ."";
      $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,NULL|'";
      $WA_fieldNames = explode("|", $WA_fieldNamesStr);
      $WA_fieldValues = explode("|", $WA_fieldValuesStr);
      $WA_columns = explode("|", $WA_columnTypesStr);
      $WA_connectionDB = $database_liremessage;
      mysql_select_db($WA_connectionDB, $WA_connection);
      mysql_query("SET NAMES UTF8"); 
      if (!session_id()) session_start();
      $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
      $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
      $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
      $_SESSION[$WA_sessionName] = mysql_insert_id();
      if ($WA_redirectURL != "")  {
        if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
          $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
        }
        header("Location: ".$WA_redirectURL);
      }
    }
    ?>
    comment puis je récupérer $_POST['search1'].$_POST['search2'].$_POST['search3']; pour l'inserer dans la requête d'insertion

    merci !

  4. #4
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Bonjour,

    Si tu as bien modifier les noms des trois select, tu devrais pour voir afficher au début de ton code (ton post du dessus) les $_POST.

    Fait:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    <?php 
     
    print_r($_POST);  // ou var_dump
    if (isset($_POST["Insert"])) // Trigger
    {
      $WA_connection = $liremessage;
      $WA_table = "search";
      $WA_sessionName = "WADA_Insert_search";
    .....
    et donnes moi l'affichage ....

    Ensuite tu as
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    ((isset($_POST["search_xtra"]))?$_POST["search_xtra"]:"")
    que tu auras sûrement à modifier

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    la page ou est le formulaire est aussi la page qui fait le traitement de l'insertion dans la table

    j'ai ajouté la ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    print_r($_POST);  // ou var_dump
    et j'ai renomé les champs des 3 selects

    ça affiche ceci : Array ( ) et ça n'insere plus dans la table

    j'ai vu qu'il y'avait l'option multiple pour la balise select je vais essayer ça

    merci

  6. #6
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    bon quant je met multiple dans la balise select il envoie d'office la première ligne du select..pas la bonne solution

  7. #7
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    La première fois le $_POST est vide, c normal ....

    Parcontre lorsque le formulaire a fait son POST, cette variable devrait contenir quelque chose !

    Si il n'y a plus d'insertion, c que tu n'as pas renomé la variable dans le bout de code:
    $_POST['search_xtra']

    Ou alors le:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    if (isset($_POST["Insert"]))
    ne passe pas ?

    Mets le print_r dans le if pour voir.

    En dernier, une liste peut avoir une sélection multiple et dans ce cas tu récupéreras un tableau des choix.

  8. #8
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    peut etre que pour select l'option multiple ne fonctionne pas parce que j'affiche dyamiquement la valeur de la table ref , si je met en dur dans le select ça peut peut etre marcher ( une centaine de lignes mais bon..)

    sinon
    j'ai mis le print dans le if et changé le nom de la variable
    .((isset($_POST["search_xtra1"]))?$_POST["search_xtra1"]:"") .

    mais la ça affiche bizarement
    Column 'search_date' cannot be null
    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
    <?php 
     
     
    if (isset($_POST["Insert"])) // Trigger
    print_r($_POST);  // ou var_dump
    {
      $WA_connection = $liremessage;
      $WA_table = "search";
      $WA_sessionName = "WADA_Insert_search";
      $WA_redirectURL = "detail_lexique.php";
      $WA_keepQueryString = false;
      $WA_indexField = "search_id";
      $WA_fieldNamesStr = "search_nom|search_nom_uk|search_desc|search_xtra|search_doc_initiation|search_doc|search_site_blog|search_livre|search_forum|search_pub_partenaire_01|search_auteur|search_date";
      $WA_fieldValuesStr = "".((isset($_POST["search_nom"]))?$_POST["search_nom"]:"")  ."" . "|" . "".((isset($_POST["search_nom_uk"]))?$_POST["search_nom_uk"]:"")  ."" . "|" . "".((isset($_POST["search_desc"]))?$_POST["search_desc"]:"")  ."" . "|" . "".((isset($_POST["search_xtra1"]))?$_POST["search_xtra1"]:"")  ."" . "|" . "".((isset($_POST["search_doc_initiation"]))?$_POST["search_doc_initiation"]:"")  ."" . "|" . "".((isset($_POST["search_doc"]))?$_POST["search_doc"]:"")  ."" . "|" . "".((isset($_POST["search_site_blog"]))?$_POST["search_site_blog"]:"")  ."" . "|" . "".((isset($_POST["search_livre"]))?$_POST["search_livre"]:"")  ."" . "|" . "".((isset($_POST["search_forum"]))?$_POST["search_forum"]:"")  ."" . "|" . "".((isset($_POST["search_pub_partenaire_01"]))?$_POST["search_pub_partenaire_01"]:"")  ."" . "|" . "".((isset($_POST["search_auteur"]))?$_POST["search_auteur"]:"")  ."" . "|" . "".((isset($_POST["search_date"]))?$_POST["search_date"]:"")  ."";
      $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,NULL|'";
      $WA_fieldNames = explode("|", $WA_fieldNamesStr);
      $WA_fieldValues = explode("|", $WA_fieldValuesStr);
      $WA_columns = explode("|", $WA_columnTypesStr);
      $WA_connectionDB = $database_liremessage;
      mysql_select_db($WA_connectionDB, $WA_connection);
      mysql_query("SET NAMES UTF8"); 
      if (!session_id()) session_start();
      $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
      $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
      $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
      $_SESSION[$WA_sessionName] = mysql_insert_id();
      if ($WA_redirectURL != "")  {
        if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
          $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
        }
        header("Location: ".$WA_redirectURL);
      }
    }
    ?>

  9. #9
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Si c le code que tu as mis ci-dessus, ya un problème dans la syntaxe de ton if.

    Ce n'est pas:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    if (isset($_POST["Insert"])) // Trigger
    print_r($_POST);  // ou var_dump
    {
      $WA_connection = $liremessage;
      .....
    Mais:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    if (isset($_POST["Insert"])) // Trigger
    {
      print_r($_POST);  // ou var_dump
      $WA_connection = $liremessage;
      .....
    Sinon pour l'erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    ''|',none,''|',none,NULL|'";
    tu as pas un problème ici ????
    A cause de l'explode, je verrais un '|' entre le none et le NULL

    Edit: j'ai pas compté les arguments mais bon

  10. #10
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    merci

    j'ai mis le code ainsi
    plus de message d'erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    if (isset($_POST["Insert"])) // Trigger
    {
      print_r($_POST);  // ou var_dump
    mais ça insère que le dernier des 3 select dans la table


    je met ci dessous le code entier de la page d'insertion ça sera peut etre plus claire

    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
    <?php
    header('Content-type: text/html; charset=utf-8'); 
    ?>
    <?php require_once('../../../Connections/database.php'); ?>
     
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
    }
    }
     
    mysql_select_db($database_database, $database);
    $query_afficherubrique = "SELECT * FROM `ref`";
    $afficherubrique = mysql_query($query_afficherubrique, $database) or die(mysql_error());
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    $totalRows_afficherubrique = mysql_num_rows($afficherubrique);
     
    mysql_select_db($database_database, $database);
    mysql_query("SET NAMES UTF8");
    $query_afficherubrique = "SELECT * FROM `ref` ORDER BY ref_rub ASC";
    $afficherubrique = mysql_query($query_afficherubrique, $database) or die(mysql_error());
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    $totalRows_afficherubrique = mysql_num_rows($afficherubrique);
    $lien1 = $row_afficherubrique['ref_nom'];
    $lien2 = $row_afficherubrique['ref_cours'];
    ?>
    <?php require_once("Connections/database.php"); ?>
    <?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
    <?php 
    // WA Application Builder Insert
    // print_r($_POST);  // ou var_dump
     
    if (isset($_POST["Insert"])) // Trigger
    {
      print_r($_POST);  // ou var_dump
     
      $WA_connection = $database;
      $WA_table = "search";
      $WA_sessionName = "WADA_Insert_search";
      $WA_redirectURL = "detail_lexique.php";
      $WA_keepQueryString = false;
      $WA_indexField = "search_id";
      $WA_fieldNamesStr = "search_nom|search_nom_uk|search_desc|search_xtra|search_doc_initiation|search_doc|search_site_blog|search_livre|search_forum|search_pub_partenaire_01|search_auteur|search_date";
      $WA_fieldValuesStr = "".((isset($_POST["search_nom"]))?$_POST["search_nom"]:"")  ."" . "|" . "".((isset($_POST["search_nom_uk"]))?$_POST["search_nom_uk"]:"")  ."" . "|" . "".((isset($_POST["search_desc"]))?$_POST["search_desc"]:"")  ."" . "|" . "".((isset($_POST["search_xtra1"]))?$_POST["search_xtra1"]:"")  ."" . "|" . "".((isset($_POST["search_doc_initiation"]))?$_POST["search_doc_initiation"]:"")  ."" . "|" . "".((isset($_POST["search_doc"]))?$_POST["search_doc"]:"")  ."" . "|" . "".((isset($_POST["search_site_blog"]))?$_POST["search_site_blog"]:"")  ."" . "|" . "".((isset($_POST["search_livre"]))?$_POST["search_livre"]:"")  ."" . "|" . "".((isset($_POST["search_forum"]))?$_POST["search_forum"]:"")  ."" . "|" . "".((isset($_POST["search_pub_partenaire_01"]))?$_POST["search_pub_partenaire_01"]:"")  ."" . "|" . "".((isset($_POST["search_auteur"]))?$_POST["search_auteur"]:"")  ."" . "|" . "".((isset($_POST["search_date"]))?$_POST["search_date"]:"")  ."";
      $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,NULL|'";
      $WA_fieldNames = explode("|", $WA_fieldNamesStr);
      $WA_fieldValues = explode("|", $WA_fieldValuesStr);
      $WA_columns = explode("|", $WA_columnTypesStr);
      $WA_connectionDB = $database_database;
      mysql_select_db($WA_connectionDB, $WA_connection);
      mysql_query("SET NAMES UTF8"); 
      if (!session_id()) session_start();
      $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
      $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
      $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
      $_SESSION[$WA_sessionName] = mysql_insert_id();
      if ($WA_redirectURL != "")  {
        if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
          $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
        }
        header("Location: ".$WA_redirectURL);
      }
    }
    ?>
    <!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=utf-8" />
    <title>Insert search</title>
    <link href="WA_DataAssist/styles/Elemental_Pacifica.css" rel="stylesheet" type="text/css" />
    <link href="WA_DataAssist/styles/Verdana.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="openwysiwyg2/wysiwyg.js"></script>
    </head>
     
    <body>
     
    <div class="WADAInsertContainer">
      <form action="insertion_lexique.php" method="post" name="WADAInsertForm" id="WADAInsertForm">
        <div class="WADAHeader">Inserer un enregistrement</div>
        <table border="0" align="center" cellpadding="0" cellspacing="0" class="WADADataTable">
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">Mot :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><input type="text" name="search_nom" id="search_nom" value="" size="60" /></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">Mot anglais :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><input type="text" name="search_nom_uk" id="search_nom_uk" value="" size="60" /></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">description :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_desc', '690', '200');
          </script><textarea name="search_desc" cols="60" id="search_desc"></textarea> <script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_desc', '500', '200');
            </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">1er lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select  name="search_xtra1" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4"class="WADADataTableHeader">2 em lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra2" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">3 em lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra3" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th bgcolor="#FFCC00" class="WADADataTableHeader">Document Initiation :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_doc_initiation', '690', '200');
          </script><textarea id="search_doc_initiation" name="search_doc_initiation" style="width:100%"></textarea>
            <script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_doc_initiation', '500', '200');
            </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">site_blog :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><script language="javascript1.2">
      generate_wysiwyg('search_site_blog', '690', '200');</script><textarea id="search_site_blog" name="search_site_blog" style="width:100%"></textarea>
    		<script language="javascript1.2">
      generate_wysiwyg('search_site_blog', '500', '200');
    </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">livre :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><textarea name="search_livre" cols="60" id="search_livre"></textarea></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">forum :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><script language="javascript1.2">
      generate_wysiwyg('search_forum', '690', '200');</script><textarea name="search_forum" cols="60" id="search_forum"></textarea> <script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_forum', '500', '200');
            </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">pub_partenaire :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><textarea name="search_pub_partenaire_01" cols="60" id="search_pub_partenaire_01"></textarea></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">auteur :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><input type="text" name="search_auteur" id="search_auteur" value="" size="60" /></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">date :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><input type="text" name="search_date" id="search_date" value="<?php echo date("Y-m-d" ); ?>" size="32" /></td>
          </tr>
        </table>
        <div class="WADAButtonRow">
          <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="Submit" name="Insert" id="Insert" value="Insertion" /></td>
              <td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Cancel" class="WADATextButton"><a href="preview_lexique.php">Cancel</a></span></td>
            </tr>
          </table>
    <input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
        </div>
      </form>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($afficherubrique);
    ?>

  11. #11
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    j'ai ajouter dans la partie insertion ceci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <?php echo(isset($_POST['search_xtra'])?$_POST['search_xtra']:"" ?><?php echo(isset($_POST['search_xtra2'])?$_POST['search_xtra2']:"" ?><?php echo(isset($_POST['search_xtra3'])?
    ce qui donne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    $WA_fieldNamesStr = "search_nom|search_nom_uk|search_desc|search_xtra|search_doc_initiation|search_doc|search_site_blog|search_livre|search_forum|search_pub_partenaire_01|search_auteur|search_date";
      $WA_fieldValuesStr = "".((isset($_POST["search_nom"]))?$_POST["search_nom"]:"")  ."" . "|" . "".((isset($_POST["search_nom_uk"]))?$_POST["search_nom_uk"]:"")  ."" . "|" . "".((isset($_POST["search_desc"]))?$_POST["search_desc"]:"")  ."" . "|" ?><?php echo((isset($_POST["search_xtra"]))?$_POST["search_xtra"]:"") ?><?php echo((isset($_POST["search_xtra2"]))?$_POST["search_xtra2"]:"") ?><?php echo((isset($_POST["search_xtra3"]))?$_POST["search_xtra3"]:"") ?><?php "|" . "".((isset($_POST["search_doc_initiation"]))?$_POST["search_doc_initiation"]:"")  ."" . "|" . "".((isset($_POST["search_doc"]))?$_POST["search_doc"]:"")  ."" . "|" . "".((isset($_POST["search_site_blog"]))?$_POST["search_site_blog"]:"")  ."" . "|" . "".((isset($_POST["search_livre"]))?$_POST["search_livre"]:"")  ."" . "|" . "".((isset($_POST["search_forum"]))?$_POST["search_forum"]:"")  ."" . "|" . "".((isset($_POST["search_pub_partenaire_01"]))?$_POST["search_pub_partenaire_01"]:"")  ."" . "|" . "".((isset($_POST["search_auteur"]))?$_POST["search_auteur"]:"")  ."" . "|" . "".((isset($_POST["search_date"]))?$_POST["search_date"]:"")  ."";
      $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,NULL|'";
    mais il n'enregistre dans la table à la colonne search_extra que la première valeur des 3 selects

  12. #12
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Bonjour,

    Je crois que j'avais oublié ton post

    Reprennons nos béêe,

    Dans le print_r du POST tu as biens les trois valeurs de tes select ?

  13. #13
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Tu peux me donner l'affichage de ta requête $WA_Sql ?

    Est elle correcte ?

  14. #14
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    pas de problème, merci à toi de prendre du temps pour m'aider.

    quant j'ajoute la ligne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    if (isset($_POST["Insert"])) // Trigger
    {
      print_r($_POST);  // ou var_dump
    ça ne fait rien de particulier

    l'affichage de la requette se fait sur cette page ( detail.php )

    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
    <?php require_once('Connections/database.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
    }
    }
    ?>
    <?php
    if (!session_id()) session_start(); 
    ?>
    <?php
    $Paramsearch_id_WADAsearch = "-1";
    if (isset($_GET['search_id'])) {
      $Paramsearch_id_WADAsearch = (get_magic_quotes_gpc()) ? $_GET['search_id'] : addslashes($_GET['search_id']);
    }
    $ParamSessionsearch_id_WADAsearch = "-1";
    if (isset($_SESSION['WADA_Insert_search'])) {
      $ParamSessionsearch_id_WADAsearch = (get_magic_quotes_gpc()) ? $_SESSION['WADA_Insert_search'] : addslashes($_SESSION['WADA_Insert_search']);
    }
    $Paramsearch_id2_WADAsearch = "-1";
    if (isset($_GET['search_id'])) {
      $Paramsearch_id2_WADAsearch = (get_magic_quotes_gpc()) ? $_GET['search_id'] : addslashes($_GET['search_id']);
    }
    mysql_select_db($database_database, $database);
    $query_WADAsearch = sprintf("SELECT search_id, search_nom, search_nom_uk, search_desc, search_xtra, search_doc_initiation, search_doc, search_site_blog, search_livre, search_forum, search_pub_partenaire_01, search_auteur, search_date FROM search WHERE search_id = %s OR ( -1= %s AND search_id= %s)", GetSQLValueString($Paramsearch_id_WADAsearch, "int"),GetSQLValueString($Paramsearch_id2_WADAsearch, "int"),GetSQLValueString($ParamSessionsearch_id_WADAsearch, "int"));
    $WADAsearch = mysql_query($query_WADAsearch, $database) or die(mysql_error());
    $row_WADAsearch = mysql_fetch_assoc($WADAsearch);
    $totalRows_WADAsearch = mysql_num_rows($WADAsearch);
    ?>
    <!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>Details search</title>
    <link href="WA_DataAssist/styles/Elemental_Pacifica.css" rel="stylesheet" type="text/css" />
    <link href="WA_DataAssist/styles/Verdana.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    /* Details page CSS */
    .WADADetailsContainer {
    	font-size: 11px;
    }
    #WADADetails, .WADANoResults {
    	border-top: 1px solid #BABDC2;
    	padding-top: 7px;
    }
    </style>
    </head>
     
    <body>
     
     
    <div class="WADADetailsContainer"> <a name="top"></a>
      <?php if ($totalRows_WADAsearch > 0) { // Show if recordset not empty ?>
        <div id="WADADetails">
          <div class="WADAHeader">Details de la modification pour le mot : <?php echo($row_WADAsearch['search_nom']); ?></div>
          <table border="0" align="center" cellpadding="0" cellspacing="0" class="WADADataTable">
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">Mot :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_nom']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">Mot anglais :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_nom_uk']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">description :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_desc']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">lien vers le cours html :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_xtra']); ?></td>
            </tr>
            <tr>
              <th bgcolor="#FFCC00" class="WADADataTableHeader">Document Initiation :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_doc_initiation']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">site_blog :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_site_blog']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">livre :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_livre']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">forum :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_forum']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">pub_partenaire :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_pub_partenaire_01']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">auteur :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_auteur']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">date :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_date']); ?></td>
            </tr>
          </table>
          <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
          <div class="WADAButtonRow">
            <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Update" class="WADATextButton"><a href="modifier_lexique.php?search_id=<?php echo(rawurlencode($row_WADAsearch['search_id'])); ?>">Modifier cet enregistrement</a></span></td>
                <td class="WADADataNavButtonCell" nowrap="nowrap"></td>
                <td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Results" class="WADATextButton"><a href="preview_lexique.php">Preview</a></span></td>
              </tr>
            </table>
          </div>
        </div>
      <?php } // Show if recordset not empty ?>
      <?php if ($totalRows_WADAsearch == 0) { // Show if recordset empty ?>
        <div class="WADANoResults">
          <div class="WADANoResultsMessage">No record found.</div>
        </div>
        <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
        <div class="WADADetailsLinkArea">
          <div class="WADADataNavButtonCell"><span id="Results1" class="WADATextButton"><a href="preview_lexique.php">Results</a></span></div>
        </div>
        <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
      <?php } // Show if recordset empty ?>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($WADAsearch);
    ?>

  15. #15
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Non,

    Ce que je voulais, c un echo de $WA_Sql par exemple au moment de l'insert:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
      if (!session_id()) session_start();
      $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
      $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
    echo "$WA_Sql ";
    Sinon, pour le print_r
    quant j'ajoute la ligne


    Code :
    if (isset($_POST["Insert"])) // Trigger
    {
    print_r($_POST); // ou var_dump
    ça ne fait rien de particulier
    C à dire, il n'y a pas d'affichage ?

    ARgheuuu, c domage que j'ai pas les moyens de tester directement

    J'ai l'impression que l'on tourne en rond

    courage

  16. #16
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    je met ici les pages concerné par mon problème de select je ne sais pas si ça peut aider pour tester en local

    la page d'insertion "insertion_lexique.php""

    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
    233
    234
    235
    236
    237
    238
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
    }
    }
     
    mysql_select_db($database_database, $database);
    $query_afficherubrique = "SELECT * FROM `ref`";
    $afficherubrique = mysql_query($query_afficherubrique, $database) or die(mysql_error());
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    $totalRows_afficherubrique = mysql_num_rows($afficherubrique);
     
    mysql_select_db($database_database, $database);
    mysql_query("SET NAMES UTF8");
    $query_afficherubrique = "SELECT * FROM `ref` ORDER BY ref_rub ASC";
    $afficherubrique = mysql_query($query_afficherubrique, $database) or die(mysql_error());
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    $totalRows_afficherubrique = mysql_num_rows($afficherubrique);
    $lien1 = $row_afficherubrique['ref_nom'];
    $lien2 = $row_afficherubrique['ref_cours'];
    ?>
    <?php require_once("Connections/database.php"); ?>
    <?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
    <?php 
    // WA Application Builder Insert
    // print_r($_POST);  // ou var_dump
     
    if (isset($_POST["Insert"])) // Trigger
    {
      print_r($_POST);  // ou var_dump
     
      $WA_connection = $database;
      $WA_table = "search";
      $WA_sessionName = "WADA_Insert_search";
      $WA_redirectURL = "detail_lexique.php";
      $WA_keepQueryString = false;
      $WA_indexField = "search_id";
      $WA_fieldNamesStr = "search_nom|search_nom_uk|search_desc|search_xtra|search_doc_initiation|search_doc|search_site_blog|search_livre|search_forum|search_pub_partenaire_01|search_auteur|search_date";
      $WA_fieldValuesStr = "".((isset($_POST["search_nom"]))?$_POST["search_nom"]:"")  ."" . "|" . "".((isset($_POST["search_nom_uk"]))?$_POST["search_nom_uk"]:"")  ."" . "|" . "".((isset($_POST["search_desc"]))?$_POST["search_desc"]:"")  ."" . "|" .((isset($_POST["search_xtra"]))?$_POST["search_xtra"]:"") .", ".((isset($_POST["search_xtra2"]))?$_POST["search_xtra2"]:"") .", ".((isset($_POST["search_xtra3"]))?$_POST["search_xtra3"]:"") ."|"   . "".((isset($_POST["search_doc_initiation"]))?$_POST["search_doc_initiation"]:"")  ."" . "|" . "".((isset($_POST["search_doc"]))?$_POST["search_doc"]:"")  ."" . "|" . "".((isset($_POST["search_site_blog"]))?$_POST["search_site_blog"]:"")  ."" . "|" . "".((isset($_POST["search_livre"]))?$_POST["search_livre"]:"")  ."" . "|" . "".((isset($_POST["search_forum"]))?$_POST["search_forum"]:"")  ."" . "|" . "".((isset($_POST["search_pub_partenaire_01"]))?$_POST["search_pub_partenaire_01"]:"")  ."" . "|" . "".((isset($_POST["search_auteur"]))?$_POST["search_auteur"]:"")  ."" . "|" . "".((isset($_POST["search_date"]))?$_POST["search_date"]:"")  ."";
      $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,NULL|'";
      $WA_fieldNames = explode("|", $WA_fieldNamesStr);
      $WA_fieldValues = explode("|", $WA_fieldValuesStr);
      $WA_columns = explode("|", $WA_columnTypesStr);
      $WA_connectionDB = $database_database;
      mysql_select_db($WA_connectionDB, $WA_connection);
      mysql_query("SET NAMES UTF8"); 
      if (!session_id()) session_start();
      $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
      $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
      echo "$WA_Sql ";
     
      $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
      $_SESSION[$WA_sessionName] = mysql_insert_id();
      if ($WA_redirectURL != "")  {
        if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
          $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
        }
        header("Location: ".$WA_redirectURL);
      }
    }
    ?>
    <!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=utf-8" />
    <title>Insert search</title>
    <link href="WA_DataAssist/styles/Elemental_Pacifica.css" rel="stylesheet" type="text/css" />
    <link href="WA_DataAssist/styles/Verdana.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="openwysiwyg2/wysiwyg.js"></script>
    </head>
     
    <body>
     
    <div class="WADAInsertContainer">
      <form action="insertion_lexique.php" method="post" name="WADAInsertForm" id="WADAInsertForm">
        <div class="WADAHeader">Inserer un enregistrement</div>
        <table border="0" align="center" cellpadding="0" cellspacing="0" class="WADADataTable">
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">Mot :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><input type="text" name="search_nom" id="search_nom" value="" size="60" /></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">Mot anglais :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><input type="text" name="search_nom_uk" id="search_nom_uk" value="" size="60" /></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">description :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_desc', '690', '200');
          </script><textarea name="search_desc" cols="60" id="search_desc"></textarea> <script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_desc', '500', '200');
            </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">1er lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select  name="search_xtra" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4"class="WADADataTableHeader">2 em lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra2" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">3 em lien vers le cours :</th>
            <td bgcolor="#FFF0C4" ><select name="search_xtra3" id="search_xtra">
              <?php
    do {  
    ?>
              <option value="<?php echo $row_afficherubrique['ref_nom'] ;?><?php echo "#" ;?><?php echo $row_afficherubrique['ref_cours'] ;?> "><?php echo $row_afficherubrique['ref_nom']?></option>
              <?php
    } while ($row_afficherubrique = mysql_fetch_assoc($afficherubrique));
      $rows = mysql_num_rows($afficherubrique);
      if($rows > 0) {
          mysql_data_seek($afficherubrique, 0);
    	  $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
      }
    ?>
            </select></td>
          </tr>
          <tr>
            <th colspan="2" align="left" valign="top" bgcolor="#FFF0C4" ><span class="WADAMessage">Attention : pour mettre un lien vers le cours html : nom du cours#Nom du dossier<br />
    exemple pour mettre un lien vers le cours 
              Action mettre :<br />
    ACTIONS (1) : LES DIFFERENTES ACTIONS#M24 /<br />
    <br />
    pour mettre plusieurs liens <br />
    Nom du premier cours#Nom du dossier/Nom du second cours#Nom du dossier<br />
    exemple :<br />
    ACTIONS (1) : LES DIFFERENTES ACTIONS#M24 /ACTIONS (2) : DROITS PECUNIAIRES#M25 /ACTIONS (3) : POUVOIR DES ACTIONNAIRES#M26 / </span></th>
          </tr>
          <tr>
            <th bgcolor="#FFCC00" class="WADADataTableHeader">Document Initiation :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_doc_initiation', '690', '200');
          </script><textarea id="search_doc_initiation" name="search_doc_initiation" style="width:100%"></textarea>
            <script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_doc_initiation', '500', '200');
            </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">site_blog :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><script language="javascript1.2">
      generate_wysiwyg('search_site_blog', '690', '200');</script><textarea id="search_site_blog" name="search_site_blog" style="width:100%"></textarea>
    		<script language="javascript1.2">
      generate_wysiwyg('search_site_blog', '500', '200');
    </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">livre :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><textarea name="search_livre" cols="60" id="search_livre"></textarea></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">forum :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><script language="javascript1.2">
      generate_wysiwyg('search_forum', '690', '200');</script><textarea name="search_forum" cols="60" id="search_forum"></textarea> <script language="JavaScript1.2" type="text/javascript">
      generate_wysiwyg('search_forum', '500', '200');
            </script></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">pub_partenaire :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><textarea name="search_pub_partenaire_01" cols="60" id="search_pub_partenaire_01"></textarea></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">auteur :</th>
            <td bgcolor="#FFF0C4" class="WADADataTableCell"><input type="text" name="search_auteur" id="search_auteur" value="" size="60" /></td>
          </tr>
          <tr>
            <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">date :</th>
            <td bgcolor="#FFCC00" class="WADADataTableCell"><input type="text" name="search_date" id="search_date" value="<?php echo date("Y-m-d" ); ?>" size="32" /></td>
          </tr>
        </table>
        <div class="WADAButtonRow">
          <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="Submit" name="Insert" id="Insert" value="Insertion" /></td>
              <td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Cancel" class="WADATextButton"><a href="preview_lexique.php">Cancel</a></span></td>
            </tr>
          </table>
    <input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
        </div>
      </form>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($afficherubrique);
    ?>
    la page "detail_lexique.php" qui affiche le résultat de cette insertion dans la base

    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
    <?php
    header('Content-type: text/html; charset=utf-8'); //On précise le type des données qui vont être transférées depuis le serveur (ici, du texte utilisant le jeu de caractères iso-8859-1
    ?>
    <?php require_once('Connections/database.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
    }
    }
    ?>
    <?php
    if (!session_id()) session_start(); 
    ?>
    <?php
    $Paramsearch_id_WADAsearch = "-1";
    if (isset($_GET['search_id'])) {
      $Paramsearch_id_WADAsearch = (get_magic_quotes_gpc()) ? $_GET['search_id'] : addslashes($_GET['search_id']);
    }
    $ParamSessionsearch_id_WADAsearch = "-1";
    if (isset($_SESSION['WADA_Insert_search'])) {
      $ParamSessionsearch_id_WADAsearch = (get_magic_quotes_gpc()) ? $_SESSION['WADA_Insert_search'] : addslashes($_SESSION['WADA_Insert_search']);
    }
    $Paramsearch_id2_WADAsearch = "-1";
    if (isset($_GET['search_id'])) {
      $Paramsearch_id2_WADAsearch = (get_magic_quotes_gpc()) ? $_GET['search_id'] : addslashes($_GET['search_id']);
    }
    mysql_select_db($database_database, $database);
    $query_WADAsearch = sprintf("SELECT search_id, search_nom, search_nom_uk, search_desc, search_xtra, search_doc_initiation, search_doc, search_site_blog, search_livre, search_forum, search_pub_partenaire_01, search_auteur, search_date FROM search WHERE search_id = %s OR ( -1= %s AND search_id= %s)", GetSQLValueString($Paramsearch_id_WADAsearch, "int"),GetSQLValueString($Paramsearch_id2_WADAsearch, "int"),GetSQLValueString($ParamSessionsearch_id_WADAsearch, "int"));
    $WADAsearch = mysql_query($query_WADAsearch, $database) or die(mysql_error());
    $row_WADAsearch = mysql_fetch_assoc($WADAsearch);
    $totalRows_WADAsearch = mysql_num_rows($WADAsearch);
    ?>
    <!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>Details search</title>
    <link href="WA_DataAssist/styles/Elemental_Pacifica.css" rel="stylesheet" type="text/css" />
    <link href="WA_DataAssist/styles/Verdana.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    /* Details page CSS */
    .WADADetailsContainer {
    	font-size: 11px;
    }
    #WADADetails, .WADANoResults {
    	border-top: 1px solid #BABDC2;
    	padding-top: 7px;
    }
    </style>
    </head>
     
    <body>
     
     
    <div class="WADADetailsContainer"> <a name="top"></a>
      <?php if ($totalRows_WADAsearch > 0) { // Show if recordset not empty ?>
        <div id="WADADetails">
          <div class="WADAHeader">Details de la modification pour le mot : <?php echo($row_WADAsearch['search_nom']); ?></div>
          <table border="0" align="center" cellpadding="0" cellspacing="0" class="WADADataTable">
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">Mot :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_nom']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">Mot anglais :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_nom_uk']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">description :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_desc']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">lien vers le cours html :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_xtra']); ?></td>
            </tr>
            <tr>
              <th bgcolor="#FFCC00" class="WADADataTableHeader">Document Initiation :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_doc_initiation']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">site_blog :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_site_blog']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">livre :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_livre']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">forum :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_forum']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">pub_partenaire :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_pub_partenaire_01']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFF0C4" class="WADADataTableHeader">auteur :</th>
              <td bgcolor="#FFF0C4" class="WADADataTableCell"><?php echo($row_WADAsearch['search_auteur']); ?></td>
            </tr>
            <tr>
              <th align="left" valign="top" bgcolor="#FFCC00" class="WADADataTableHeader">date :</th>
              <td bgcolor="#FFCC00" class="WADADataTableCell"><?php echo($row_WADAsearch['search_date']); ?></td>
            </tr>
          </table>
          <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
          <div class="WADAButtonRow">
            <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Update" class="WADATextButton"><a href="modifier_lexique.php?search_id=<?php echo(rawurlencode($row_WADAsearch['search_id'])); ?>">Modifier cet enregistrement</a></span></td>
                <td class="WADADataNavButtonCell" nowrap="nowrap"></td>
                <td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Results" class="WADATextButton"><a href="preview_lexique.php">Preview</a></span></td>
              </tr>
            </table>
          </div>
        </div>
      <?php } // Show if recordset not empty ?>
      <?php if ($totalRows_WADAsearch == 0) { // Show if recordset empty ?>
        <div class="WADANoResults">
          <div class="WADANoResultsMessage">No record found.</div>
        </div>
        <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
        <div class="WADADetailsLinkArea">
          <div class="WADADataNavButtonCell"><span id="Results1" class="WADATextButton"><a href="preview_lexique.php">Results</a></span></div>
        </div>
        <div class="WADAHorizLine"><img src="WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
      <?php } // Show if recordset empty ?>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($WADAsearch);
    ?>
    la page "WA_AppBuilder_PHP.php" qui appel des fonctions

    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
    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
    <?php
     
     
    // Application Builder functions
    function WA_AB_getLoopedFieldName($tName, $loopInde) {
      if (!strlen($tName)) {
        return $tName;
      }
      if (strlen($tName) == 1 || substr($tName, strlen($tName)-1) != "_") {
        $tName = $tName . "_";
      }
      return $tName . $loopInde;
    }
     
    function WA_AB_getLoopedFieldValue($loopedFieldName, $counterVal) {
      $loopedFieldName = WA_AB_getLoopedFieldName($loopedFieldName, $counterVal);
      if ($loopedFieldName != "" && (isset($_POST[$loopedFieldName]) || isset($_GET[$loopedFieldName]))) {
        if (isset($_POST[$loopedFieldName])) {
          return $_POST[$loopedFieldName];
        }
        return $_GET[$loopedFieldName];
      }
      return "";
    }
     
    function WA_AB_checkLoopedFieldsExist($loopedFields, $counterVal) {
      for ($n=0; $n<sizeof($loopedFields); $n++) {
        $loopedFieldName = WA_AB_getLoopedFieldName($loopedFields[$n], $counterVal);
        if ($loopedFieldName != "" && (isset($_POST[$loopedFieldName]) || isset($_GET[$loopedFieldName]))) {
          return true;
        }
      }
      return false;
    }
     
    function WA_AB_checkMultiInsertLoopedFieldsExist($loopedFields, $counterVal) {
      for ($n=0; $n<sizeof($loopedFields); $n++) {
        $loopedFieldName = WA_AB_getLoopedFieldName($loopedFields[$n] . "_mihidden", $counterVal);
        if ($loopedFieldName != "" && (isset($_POST[$loopedFieldName]) || isset($_GET[$loopedFieldName]))) {
          return true;
        }
      }
      return false;
    }
     
    function WA_AB_checkLoopedFieldsNotBlank($loopedFields, $counterVal) {
      if (!WA_AB_checkLoopedFieldsExist($loopedFields, $counterVal)) {
        return false;
      }
      for ($n=0; $n<sizeof($loopedFields); $n++) {
        if (WA_AB_getLoopedFieldValue($loopedFields[$n], $counterVal) != "") {
          return true;
        }
      }
      return false;
    }
     
    function WA_AB_returnPreSelectValue($PreSelectArray, $optionValue) {
      for ($n=0; $n<sizeof($PreSelectArray); $n++) {
        if ($PreSelectArray[$n] == $optionValue) {
          return $optionValue;
        }
      }
      return $optionValue . "DONOTSELECT";
    }
     
    function WA_AB_doManageRelationalTable($WA_valuesList, $WA_appliedString, $WA_appliedList, $WA_connection, $WA_table, $WA_masterKeyField, $WA_masterKeyType, $WA_masterKeyValue, $WA_masterKeyComp, $WA_joinedKeyField, $WA_joinedKeyType, $WA_joinedKeyComp, $WA_fieldNamesStr, $WA_columnTypesStr) {
      $WA_fieldNames = explode("|", $WA_fieldNamesStr);
      $WA_columns = explode("|", $WA_columnTypesStr);
      $WA_formerString = "";
      $WA_formerList = array();
      $WA_insertIDs = "";
      $WhereObj = WA_AB_generateWhereClause(array($WA_masterKeyField), array($WA_masterKeyType), array($WA_masterKeyValue), array($WA_masterKeyComp));
      $WA_Sql = "SELECT ".$WA_masterKeyField.", ".$WA_joinedKeyField." FROM ".$WA_table." WHERE ".$WhereObj->sqlWhereClause." ORDER BY ".$WA_joinedKeyField;
      $WA_mrtJoinRS = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
      if (mysql_num_rows($WA_mrtJoinRS) > 0) {
        while ($row_WA_mrtJoinRS = mysql_fetch_assoc($WA_mrtJoinRS)) {
          $WA_formerString .= "^" . $row_WA_mrtJoinRS[$WA_joinedKeyField] . "^";
          $WA_formerList[] = $row_WA_mrtJoinRS[$WA_joinedKeyField];
        }
      }
      for ($n=0; $n<sizeof($WA_formerList); $n++) {
        if (strpos($WA_appliedString, "^" . $WA_formerList[$n] . "^") === false) {
          $deleteParamsObj = WA_AB_generateWhereClause(array($WA_masterKeyField, $WA_joinedKeyField), array($WA_masterKeyType, $WA_joinedKeyType), array($WA_masterKeyValue, $WA_formerList[$n]), array($WA_masterKeyComp, $WA_joinedKeyComp));
          $WA_Sql = "DELETE FROM `" . $WA_table . "` WHERE " . $deleteParamsObj->sqlWhereClause;
          $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
        }
      }
      for ($n=0; $n<sizeof($WA_appliedList); $n++) {
        if (strpos($WA_formerString, "^" . $WA_appliedList[$n] . "^") === false) {
          $WA_insertIDs .= "^" . $WA_appliedList[$n] . "^";
        }
      }
      for ($n=0; $n<sizeof($WA_valuesList); $n++) {
        $WA_fieldValues = explode("|", str_replace("^MASTERID^", $WA_masterKeyValue, str_replace("^JOINID^", $WA_valuesList[$n][0], $WA_valuesList[$n][1])));
        if (strpos($WA_insertIDs, "^" . $WA_valuesList[$n][0] . "^") === false) {
          if (str_replace("^MASTERID^", "", str_replace("^JOINID^", "", $WA_valuesList[$n][1])) != "|") {
            $updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
            $WhereObj = WA_AB_generateWhereClause(array($WA_masterKeyField, $WA_joinedKeyField), array($WA_masterKeyType, $WA_joinedKeyType), array($WA_masterKeyValue, $WA_valuesList[$n][0]), array($WA_masterKeyComp, $WA_joinedKeyComp));
            $WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
            $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
          }
        }
        else {
          $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
          $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
          $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
        }
      }
    }
     
    class WA_AB_InsertParams {
      var $WA_tableValues;
      var $WA_dbValues;
      var $WA_setValues;
      function WA_AB_InsertParams($WA_tableValues = "", $WA_dbValues = "", $WA_setValues = "")     {
        $this->WA_tableValues = $WA_tableValues;
        $this->WA_dbValues = $WA_dbValues;
        $this->WA_setValues = $WA_setValues;
      }
    }
    function WA_AB_generateInsertParams($fieldNameList, $columnTypeList, $fieldValueList, $ignoreIndex)     {
      $obj = new WA_AB_InsertParams();
      for ($i=0; $i < sizeof($fieldNameList); $i++)     {
        if ($i !== $ignoreIndex)  {
          $formVal = $fieldValueList[$i];
          $WA_typesArray = explode(",", $columnTypeList[$i]);
          $delim =    ($WA_typesArray[0] != "none") ? $WA_typesArray[0] : "";
          $altVal =   ($WA_typesArray[1] != "none") ? $WA_typesArray[1] : "";
          $emptyVal = ($WA_typesArray[2] != "none") ? $WA_typesArray[2] : "";
      	  if ($formVal == "" || $formVal == "undefined")     {
            $formVal = $emptyVal;
          } else     {
            if ($altVal != "")     {
              $formVal = $altVal;
            } else if ($delim == "'")     { // escape quotes
    		  $formVal = "'".((!(preg_match("/(^|[^\\\\])'/", $formVal))) ? $formVal : addslashes($formVal))."'";
            } else if ($delim == "") {
    	   	//numeric
    		  if (is_numeric($formVal)) {
    			$formVal = "".floatval($formVal);
    		  }
    		  else {
    			$formVal = "0";
    		  }
    	    }
    	    else    {
              $formVal = $delim.WA_AB_clearOutSQLKeywords($formVal).$delim;
            }
          }
          $obj->WA_tableValues .= (($obj->WA_tableValues != "") ? "," : "") . "`" .  WA_AB_cleanUpColumnName($fieldNameList[$i]) . "`";
          $obj->WA_dbValues .= (($obj->WA_dbValues != "") ? "," : "") . $formVal;
          $obj->WA_setValues .= (($obj->WA_setValues != "") ? ", " : "") . "`" . WA_AB_cleanUpColumnName($fieldNameList[$i]) ."`" . " = " . $formVal;
        }
      }
      return $obj;
    }
     
    class WA_AB_WhereClause {
      var $sqlWhereClause;
      function WA_AB_WhereClause($sqlWhereClause = "") {
        $this->WA_AB_WhereClause = $sqlWhereClause;
      }
    }
    function WA_AB_generateWhereClause($fieldNameList, $columnTypeList, $fieldValueList, $comparisonList)
    {
      $obj = new WA_AB_WhereClause();
      for ($i = 0; $i < sizeof($fieldNameList); $i++)     {
          $formVal = $fieldValueList[$i];
          $WA_typesArray = explode(",", $columnTypeList[$i]);
          $delim =    ($WA_typesArray[0] != "none") ? $WA_typesArray[0] : "";
          $altVal =   ($WA_typesArray[1] != "none") ? $WA_typesArray[1] : "";
          $emptyVal = ($WA_typesArray[2] != "none") ? $WA_typesArray[2] : "";
          if ($formVal == "" || $formVal == "undefined") {
            $formVal = $emptyVal; 
          } else     {
            if ($altVal != "")     {
              $formVal = $altVal;
            } else if ($delim == "'")     { // escape quotes
    		  $formVal = "'".((!(preg_match("/(^|[^\\\\])'/", $formVal))) ? $formVal : addslashes($formVal));
              if ($comparisonList[$i] == " LIKE ") $formVal .= "%";;
              $formVal .= "'";
            } else if ($delim == "") {
    	   	//numeric
    		  if (is_numeric($formVal)) {
    			$formVal = "".floatval($formVal);
    		  }
    		  else {
    			$formVal = "0";
    		  }
    	    } else     {
              $formVal = $delim.WA_AB_clearOutSQLKeywords($formVal).$delim;
            }
          }
    	  if (!($delim == "" && strpos($formVal,"()")>0))  {
            if ($formVal == "NULL")  {
              $obj->sqlWhereClause .= (($i != 0) ? " AND " : "")."`". WA_AB_cleanUpColumnName($fieldNameList[$i])."`"." IS ".$formVal;
            }
            else  {
              $obj->sqlWhereClause .= (($i != 0) ? " AND " : "")."`". WA_AB_cleanUpColumnName($fieldNameList[$i])."`".WA_AB_cleanUpEquality($comparisonList[$i]).$formVal;
            }
          }
      }
      return $obj;
    }
     
    function WA_AB_cleanUpColumnName($colName) {
    	if (strpos($colName, ";") !== false) {
    		$colName = substr($colName, 0, strpos($colName, ";"));
    	}
    	if (strpos($colName, "(") !== false) {
    		$colName = substr($colName, 0, strpos($colName, "("));
    	}
    	if (strpos($colName, "=") !== false) {
    		$colName = substr($colName, 0, strpos($colName, "="));
    	}
    	return $colName;
    }
     
    function WA_AB_cleanUpEquality($tEquality) {
    	if (preg_replace('/^\\s*|\\s*$/', "", $tEquality) != "=") {
    		return WA_AB_cleanUpColumnName($tEquality);
    	}
    	return $tEquality;
    }
     
    function WA_AB_clearOutSQLKeywords($tString) {
    	if (strpos(strtolower($tString), "select") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "drop") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "alter") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "create") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "update") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "insert") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "delete") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "'") !== false) {
    		return "";
    	}
    	if (strpos(strtolower($tString), "#") !== false) {
    		return "";
    	}
    	return $tString;
    }
    ?>
    la table "search"

    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
    CREATE TABLE IF NOT EXISTS `search` (
      `search_id` int(11) NOT NULL AUTO_INCREMENT,
      `search_nom` varchar(255) NOT NULL DEFAULT '',
      `search_desc` mediumtext NOT NULL,
      `search_xtra` varchar(255) NOT NULL DEFAULT '',
      `search_doc_initiation` longtext NOT NULL,
      `search_doc` mediumtext NOT NULL,
      `search_site_blog` longtext NOT NULL,
      `search_livre` longtext NOT NULL,
      `search_forum` longtext NOT NULL,
      `search_pub_partenaire_01` longtext NOT NULL,
      `search_auteur` varchar(50) NOT NULL,
      `search_date` date NOT NULL,
      `search_nom_uk` varchar(250) NOT NULL,
      `search_index_biblio` varchar(20) NOT NULL,
      PRIMARY KEY (`search_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=425 ;
     
    --
    -- Contenu de la table `search`
    --
     
    INSERT INTO `search` (`search_id`, `search_nom`, `search_desc`, `search_xtra`, `search_doc_initiation`, `search_doc`, `search_site_blog`, `search_livre`, `search_forum`, `search_pub_partenaire_01`, `search_auteur`, `search_date`, `search_nom_uk`, `search_index_biblio`) VALUES
    (1, ' Action à bon de souscription d''actions (ABSA)', 'Action émise accompagnée d''un bon de souscription d''action ; ce type de valeur mobilière permet à une entreprise de faire une augmentation de capital en deux temps.\r\n', 'ACTIONS (2) : DROITS PECUNIAIRES#M25 /', '', '', '', '', 'test forum', 'tototototottototototototot', '', '0000-00-00', '', 'ok'),
    (2, 'Actif économique ( Economic asset )', 'Désigne les ressources de l''entreprise affectées à son activité. L''actif économique se compose des immobilisations incorporelles et corporelles et du besoin en fonds de roulement.', 'ANALYSE (2) : LE BILAN#M33 /', '', '', '', '', '', '', '', '0000-00-00', '', ''),
    (3, ' Actif financier ( Financial asset )', 'Tout support d''investissement susceptible de générer des revenus. Un actif financier se caractérise par un couple risque/rendement.', 'ACTIONS ET OBLIGATIONS : INITIATION#M101 /RISQUE ET GAIN EN BOURSE#M14 /RISQUE ET GAIN EN BOURSE#M14 /', '', '', '', '', '', '', '', '0000-00-00', '', '');
    la table ref ( les 3 selects de la page "insertion_lexique.php"" vont interroger cette table pour envoyer dans la colonne search_xtra de la table search une chaine de caractères ce qui va servir à construire un lien )

    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
    CREATE TABLE IF NOT EXISTS `ref` (
      `ref_id` int(11) NOT NULL AUTO_INCREMENT,
      `ref_nom` varchar(255) NOT NULL DEFAULT '',
      `ref_cours` varchar(255) NOT NULL DEFAULT '',
      `ref_rub` int(11) NOT NULL DEFAULT '0',
      PRIMARY KEY (`ref_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=131 ;
     
    --
    -- Contenu de la table `ref`
    --
     
    INSERT INTO `ref` (`ref_id`, `ref_nom`, `ref_cours`, `ref_rub`) VALUES
    (1, 'Actions et obligations : initiation', 'M101', 1),
    (2, 'Actions (1) : Les différentes actions', 'M24', 1),
    (3, 'Actions (2) : Droits pécuniaires', 'M25', 1);
    merci de ton aide

  17. #17
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Bonjour,

    J'ai pas trop le temps de tester tout ton code mais ton problème est bien que sur les trois listes, juste la première posséde une valeur ?

    Tu m'a dis que le print_r n'affichais rien donc il n'y a pas de triatement !

    Pour le code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    if (isset($_POST["Insert"])) // Trigger
    $_POST['Insert'] est Ok
    Au fait pour des doubles quotes, des simples suffisent (mais ça changera rien )

    Autre chose:
    Pourquoi:
    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
     
    mysql_select_db($database_database, $database);
    $query_afficherubrique = "SELECT * FROM `ref`";
    $afficherubrique = mysql_query($query_afficherubrique, $database) or die(mysql_error());
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    $totalRows_afficherubrique = mysql_num_rows($afficherubrique);
     
    mysql_select_db($database_database, $database);
    mysql_query("SET NAMES UTF8");
    $query_afficherubrique = "SELECT * FROM `ref` ORDER BY ref_rub ASC";
    $afficherubrique = mysql_query($query_afficherubrique, $database) or die(mysql_error());
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    $totalRows_afficherubrique = mysql_num_rows($afficherubrique);
    $lien1 = $row_afficherubrique['ref_nom'];
    $lien2 = $row_afficherubrique['ref_cours'];
    Le premier
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $row_afficherubrique = mysql_fetch_assoc($afficherubrique);
    Ne sert à rien puisque écrasé par la deuxième requête

  18. #18
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    pour le code qui fait doublon j'ai oublié de l'effacer

    pour que print_r affiche quelque chose il faudrait que le formulaire "insertion_lexique.php" n'ailles pas sur la page d'affichage "detail_lexique.php" mais reste sur la page d'insertion non ?

    en tout cas si tu a le temps de tester ce code en local ça serait cool !

  19. #19
    Membre expert Avatar de Fench
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Mai 2002
    Messages
    2 353
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Groenland

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 353
    Points : 3 390
    Points
    3 390
    Par défaut
    Oui, le formulaire doit s'appeler


    au lieu de:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <form action="insertion_lexique.php" ...
    Essayes:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <form action="<?php echo $_SERVER['PHP_SELF'];?>  ....

  20. #20
    Membre habitué
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    412
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 412
    Points : 145
    Points
    145
    Par défaut
    voila ce que donne l'affichage

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Array ( [search_nom] => test champ mot [search_nom_uk] => test champ mot anglais [search_desc] => test description
    [search_xtra] => Obligations (1) : Les bases#M21 [search_xtra2] => Warrants (2) : La valeur#M12 [search_xtra3] => Service de Règlement Différé#M29 [search_doc_initiation] =>
    test document initiation
    [search_site_blog] => test site et blog
    [search_livre] => tesrt livre à consulter [search_forum] => test forum
    [search_pub_partenaire_01] => test pub [search_auteur] => test auteur [search_date] => 2010-01-27 [Insert] => Insertion [WADAInsertRecordID] => ) Obligations (1) : Les bases#M21 Warrants (2) : La valeur#M12 Service de Règlement Différé#M29 Column 'search_date' cannot be null

Discussions similaires

  1. Plusieurs champs NAME formulaire
    Par mikl86 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 09/11/2013, 00h02
  2. Validation de plusieurs champs de formulaire
    Par Arjuna dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 20/09/2012, 12h10
  3. Réponses: 2
    Dernier message: 04/03/2008, 10h10
  4. Recuperation plusieurs champ SELECT
    Par bullrot dans le forum C++Builder
    Réponses: 3
    Dernier message: 19/11/2007, 22h58
  5. Réponses: 7
    Dernier message: 19/09/2006, 18h02

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