Partage
  • Partager sur Facebook
  • Partager sur Twitter

TableauUne des colonnes s'affichent mal;

probablement problème avec les guillemets

Sujet résolu
    25 mai 2007 à 9:48:14

    Bonjour,

    J'ai un petit problème avec mon code.
    Je veux afficher un tableau qui montre des données que j'ai récupéré dans mes bases de données. Je n'ai pas de problème pour l'afficher, sauf pour la colonne "imprimer". Cette colonne affiche bien 'Imprimer' pour la première ligne, mais dans les suivantes, il devrait y avoir juste un dession d'imprimante sur lequel on peut cliquer pour arriver dans une autre page(qui s'appelle page_imprimable.php).Or les cases affichent des guillements et une fin de balises(">)et le dessin de l'imprimante. Il y a probablement un problème dans mes guillemets ou quelque chose comme ça.
    De plus, quand je clique dessus, j'arrive bien à la bonne page, mais les variables $_GET['solution'] $_GET['societe'] et $_GET['etat']; n'existe pas. Les autres ($_GET['numappel'];$_GET['debut'];$_GET['fin'];et $_GET['symptome'];) existent bien.

    Pouvez-vous m'aider svp?

    Voici mon code:

    <?php
                    //affichage de la 1ère ligne du tableau/"entête" du tableau
            echo "<DIV ID="topdeck" CLASS="popper"> </DIV><table align="center">   
                      <tr>
                      <th nowrap><div>Imprimer</div></td>
                      <th nowrap><div>Etat</div></td>
                    <th nowrap><div>N°d'appel</div></td>
                      <th nowrap><div>Date appel</div></td>
                      <th nowrap><div>Date cloture</div></td>
                      <th nowrap><div>Symptômes</div></td>
                      <th nowrap><div>Solutions</div></td>
                              <th nowrap><div>Nom societe</div></td>
                </tr>\n"
    ;               
                           

            if ($infos[0] == "")    
                    echo " <tr><td colspan="12" style="text-align:center;color:orange;">Aucun incident répertorié</td></tr></table><br>\n";
            else
            {
                   
                    for ($i=$first; $i<= $last; $i++)
                    {
                            switch ($infos[$i])                 //attribution d'une image selon la valeur de $infos[$i]
                            {
                                    case "En Cours" :
                                            $infos[$i]= GREEN_BALL;  //boule verte
                                    break;
                                   
                                    case "Ouvert" :
                                            $infos[$i] = GREEN_BALL;        //boule verte
                                    break;
                                   
                                    case "En attente de réponse"//boule orange
                                            $infos [$i]= ORANGE_BALL;
                                    break;
                                   
                                    case "Clos" :
                                            $infos[$i] = RED_BALL;    //boule rouge
                                    break;
                            }
                           
                                    $imprimer= IMPRIMANTE;      //$imprimer est une image d'imprimante
                           
                                    $sqlconnect=odbc_connexion()
                                    $j='0';
                                    $t=$i+6;
                                    $req="SELECT N_SITE FROM suiteisilog.SITE WHERE C_SITE='$infos[$t]'";
                                    $sqlquery= odbc_query($req);                                            //Requête
                                    $process=odbc_exec_req($sqlconnect, $sqlquery);       //Exécution de la requête
                                    while( odbc_fetch_row( $process) )                                                            //On va mettre tous les résultats dans la variables $tab
                                    {
                                            $siterecherche[$j]= odbc_aff_result($process,'N_SITE');    //variable siterecherche contient les sites à afficher dans l'ordre à afficher
                                    }

                            echo"<tr>        
                                     <td><div style="
    text-align:center;">"."<a href="page_imprimable.php?numappel=".$infos[$i+1]."&amp;debut=".$infos[$i+2]."&amp;fin=".$infos[$i+3]."&amp;symptome=".$infos[$i+4]."&amp;solution=".$infos[$i+5]."&amp;societe=".$siterecherche[$j]."&amp;etat=".$infos[$i]."">".$imprimer."</a></div></td>  //C'est cette ligne la qui s'affiche mal.
                                           
                                     <td><div>"
    .$infos[$i]."&nbsp;</div></td>
                                   
                             <td><div style="
    text-align:center;">".$infos[$i+1]."&nbsp;</div></td>
                           
                     <td><div style="
    text-align:center;">".$infos[$i+2]."&nbsp;</div></td>
           
                     <td><div style="
    text-align:center;">".$infos[$i+3]."&nbsp;</div></td>
                           
                     <td><div>"
    ."<a href="vos_incidents1.php?L_STAPPEL=".$etat."&amp;deb=".$deb."&amp;fin=".$fin."&amp;page=".$page."&amp;affiche_symptome=".$infos[$i+4].""  class="nav"  alt="". $infos[$i+4] ."" title="". $infos[$i+4] ."">".nbsubstr($infos[$i+4],30)."...&nbsp;</a></div></td>
                                   
                     <td><div>"
    ."<a href="vos_incidents1.php?L_STAPPEL=".$etat."&amp;deb=".$deb."&amp;fin=".$fin."&amp;page=".$page."&amp;affiche_solution=".$infos[$i+5]."" class="nav" alt="". $infos[$i+5] ."" title="". $infos[$i+5] ."">".nbsubstr($infos[$i+5],30)."...&nbsp;</a></div></td>  
                                           
                     <td><div style="
    text-align:center;">".$siterecherche[$j]."&nbsp;</div></td>

                             </tr>\n"
    ;$i=$i+6;
                    }
            echo "</table><br>\n";$j++;
            }?>


    • Partager sur Facebook
    • Partager sur Twitter
      25 mai 2007 à 9:58:04

      Je ne ferai aucun commentaire sur la qualité du code HTML... Commence par construire un tableau factice en dur et bien codé. Si possible avec les styles dans un fichier css.

      Puis tu découpes ton tableau convenablement pour écrire ton script PHP.
      • Partager sur Facebook
      • Partager sur Twitter
        25 mai 2007 à 10:13:39

        J'ai trouvé aucune balise <img dans ton code... Et j'ai pas envie de l'éplucher pour comprendre comment tu veux obtenir une image sans avoir <img :p

        Limite ton copier/coller à la partie utile du code, ça aidera déjà beaucoup.
        • Partager sur Facebook
        • Partager sur Twitter
          25 mai 2007 à 10:47:31

          ok, voila:



          <?php
                          //Entête du tableau
          echo"
          <table>
                  <tr>
                          <th nowrap>     Imprimer     </th>                   
                          <th nowrap>     Etat  </th>
                        <th nowrap>   N°d'appel  </th>
                          <th nowrap>     Date appel   </th>
                          <th nowrap>     Date cloture </th>
                          <th nowrap>     Symptômes    </th>
                          <th nowrap>     Solutions    </th>
                          <th nowrap>     Nom societe  </th>
                  </tr>     "
          ;

                  //$first est la première valeur que doit prendre $i et $last la dernière valeur:
                  for ($i=$first; $i<= $last; $i++)
                  {       
                          //Corps du tableau
                  echo"
                          <tr>      
                                  <td>"
          ."<a href="page_imprimable.php?numappel=".$infos[$i+1]."&amp;debut=".$infos[$i+2]."&amp;fin=".$infos[$i+3]."&amp;symptome=".$infos[$i+4]."&amp;solution=".$infos[$i+5]."&amp;societe=".$siterecherche[$j]."&amp;etat=".$infos[$i]."">".$imprimer."</a></td>                             ";//ligne ou j'ai un problème dans l'affichage et dans la page suivante, $_GET['symptome'] vaut "" et les valriables d'après n'existent pas(solution, societe et etat)
                          echo"            
                                  <td>"
          .$infos[$i]."&nbsp;    </td>                            ";//$infos[$i] contient l'Etat à afficher
                          echo"         
                                  <td>"
          .$infos[$i+1]."&nbsp;  </td>                    ";//$infos[$i+1] contient le numéro d'appel à afficher à afficher
                          echo"      
                                  <td>"
          .$infos[$i+2]."&nbsp;      </td>                                 ";//$infos[$i+2] contient la date d'appel à afficher
                          echo"
                                  <td>"
          .$infos[$i+3]."&nbsp;      </td>                                 ";//$infos[$i+3] contient la date de cloture de l'appel à afficher
                          echo"      
                                  <td>"
          ."<a href="vos_incidents1.php?L_STAPPEL=".$etat."&amp;deb=".$deb."&amp;fin=".$fin."&amp;page=".$page."&amp;affiche_symptome=".$infos[$i+4].""  class="nav"  alt="". $infos[$i+4] ."" title="". $infos[$i+4] ."">".nbsubstr($infos[$i+4],30)."...&nbsp;</a></td>    ";//affiche le symptome
                          echo"         
                                  <td>"
          ."<a href="vos_incidents1.php?L_STAPPEL=".$etat."&amp;deb=".$deb."&amp;fin=".$fin."&amp;page=".$page."&amp;affiche_solution=".$infos[$i+5]."" class="nav" alt="". $infos[$i+5] ."" title="". $infos[$i+5] ."">".nbsubstr($infos[$i+5],30)."...&nbsp;</a></td>           ";//affiche la solution
                          echo"            
                                  <td>"
          .$siterecherche[$j]."&nbsp;</td>       ";//$siterecherche[$j] contient la société à afficher

                          echo"
                          </tr>
                                 
                  <br> "
          ;
                 
                  }
                  $j++;
                  echo "</table>";
          ?>




          J'espère que c'est mieux.
          • Partager sur Facebook
          • Partager sur Twitter
            25 mai 2007 à 11:03:26

            Bon, on avance. Le problème vient de la définition de ta constante IMPRIMANTE.

            Fais donc un echo IMPRIMANTE; (Où tu veux).

            Et copie/colle le code define('IMPRIMANTE',....); , c'est cette ligne là qui est mauvaise.
            • Partager sur Facebook
            • Partager sur Twitter
              25 mai 2007 à 11:11:44

              Ca y est j'ai trouvé l'erreur!
              J'ai fait quelques petits changements par rapport à l'image et c'est bon, ça marche!
              Merci!

              J'ai une dernière question, quel est déja la fonction qui permet de ne pas tenir compte des guillements ou des apostrophes que peux contenir un message que un utilisateur poste? pcq dasn mes symptomes et solutions j'ai parfois des guillements qui font qu'ils ne s'affichent pas comme il faut.

              Merci encore pour ton aide!
              • Partager sur Facebook
              • Partager sur Twitter
                25 mai 2007 à 11:23:48

                htmlentities($texte,ENT_QUOTES)

                ou addslashes()

                ou mysql_real_espace_string()

                Selon les cas.
                • Partager sur Facebook
                • Partager sur Twitter

                TableauUne des colonnes s'affichent mal;

                × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
                × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
                • Editeur
                • Markdown