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

EDI, CMS, Outils, Scripts et API PHP Discussion :

Singulier ou pluriel et caractère non desiré en PHP


Sujet :

EDI, CMS, Outils, Scripts et API PHP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    284
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 284
    Points : 62
    Points
    62
    Par défaut Singulier ou pluriel et caractère non desiré en PHP
    bonjour,

    Je souhaiterais obtenir votre aide sur mes problèmes actuel ....
    Je souhaiterais lorsque j'affiche plusieurs résultats ajouter un 's' au mots "votes" puis évité les caractère tels que '\' lorsque on met le mot "j'ai" par exemple......j'espère être compris dans ma demande

    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
     
    //sondage aprés validation sans bouton
    if ($num > 0) {
     
    echo '<img src="img/_sondage.gif"><br>';
     
    echo '<div class="archives">'.$infos['question'].'</div>'.''. "";
    if( round($pourcentage_r1) != 0){
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1"><img src="img/sondage/vert.gif" height="16" width="' .$pourcentage_r1 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r1).'%" /> ' . round($pourcentage_r1)  . "% (".$result["resultats1"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats1"].' vote)<br /></div>';}
    if( round($pourcentage_r2) != 0){
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.'' .'<div class="date1"><img src="img/sondage/rouge.gif" height="16" width="' . $pourcentage_r2 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r2).'%" /> ' . round($pourcentage_r2)  . "% (".$result["resultats2"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition2'].'</div>'.'' .'<div class="date1">('.$result["resultats2"].' vote)<br /></div>';}
     
     if ($infos['proposition3'] != "")
     if( round($pourcentage_r3) != 0){
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.'' .'<div class="date1"><img src="img/sondage/orange.gif" height="16" width="' . $pourcentage_r3 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r3).'%" /> ' . round($pourcentage_r3)  . "% (".$result["resultats3"]."vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition3'].'</div>'.'' .'<div class="date1">('.$result["resultats3"].' vote)<br /></div>';}
     
           if ($infos['proposition4'] != "")
    if( round($pourcentage_r4) != 0){
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.'' .'<div class="date1"><img src="img/sondage/jaune.gif" height="16" width="' . $pourcentage_r4 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r4).'%" /> ' . round($pourcentage_r4)  . "% (".$result["resultats4"]."vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition4'].'</div>'.'' .'<div class="date1">('.$result["resultats4"].' vote)<br /></div>';}
     
    	        if ($infos['proposition5'] != "")
    if( round($pourcentage_r5) != 0){
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.'' .'<div class="date1"><img src="img/sondage/bleu.gif" height="16" width="' . $pourcentage_r5 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r5).'%" /> ' . round($pourcentage_r5)  . "% (".$result["resultats5"]."vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition5'].'</div>'.'' .'<div class="date1">('.$result["resultats5"].' vote)<br /></div>';}
     
    echo '<div align="right" class="archive"><a href="index.php?rub=game-editor">les résultats des anciens sondages +</a></div>';
    echo '<br/><br/><br/><br/><br/>';
    }
    merci de votre aide, qui est toujours utile à moi et aux autre cherchant les même problémes....

  2. #2
    Membre confirmé
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    504
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2008
    Messages : 504
    Points : 470
    Points
    470
    Par défaut
    Remplace

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $result["resultats1"]." vote
    par

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $result["resultats1"]." vote.($result["resultats1"] > 1 ? 's' : '')
    Concernant les \' il existe des fonctions qui les virent, tel que stripcslashes mais a mon humble avis, ton problème se situe plus haut, au moment de l'enregistrement de tes données dans la BDD... Il est probable que tu ai dans le fichier ini le GPC_MAGIC_QUOTE sur ON, ce qui fatalement rajoute des \ inutile dans les parametres que recoivent tes pages.

    On ne recommandera jamais assez de désactiver cette fonction.

  3. #3
    Membre expert
    Avatar de ThomasR
    Homme Profil pro
    Directeur technique
    Inscrit en
    Décembre 2007
    Messages
    2 230
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Décembre 2007
    Messages : 2 230
    Points : 3 972
    Points
    3 972
    Par défaut
    Bonjour,

    Une petite erreur de synthaxe, aussi, je trouve ca plus joli comme ca
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    echo $result["resultats1"].' '.($result["resultats1"] > 1 ? 'votes' : 'vote');

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    284
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 284
    Points : 62
    Points
    62
    Par défaut
    merci de la réponse, mais je n'arrive pas a inserer dans le code sans les erreurs de guillemets, si on pouvait me montrer s'il vous plait.

    j'ai une erreur par ma limitation ip ou a chaque fois qu'une ip est deja enregistré, personne d'autre peut voter.

    code probleme:
    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
     
    if(isset($_POST['sondage'])){
        $vote_ip = $_SERVER['REMOTE_ADDR'];
        $sondage_id = $numeroDuSondage['nbre_entrees'];
        $sql = "INSERT INTO t_vote (sondage_id, vote_ip) VALUES ($sondage_id, '$vote_ip')";
        mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
     
     
    }
    $query = "SELECT vote_ip FROM t_vote WHERE sondage_id="."'" . $numeroDuSondage['nbre_entrees'] . "'  " ;
    $result = mysql_query($query);
    $num = mysql_num_rows($result);
     
    ?>
    <br />
     
    <form method="post" name="sondage" >
    <?php
    $sql = "SELECT resultats1,resultats2,resultats3,resultats4, resultats5 FROM ".$table." WHERE id="."'" . $numeroDuSondage['nbre_entrees'] . "' ";
    //exécution de notre requête SQL:
    $requete = mysql_query( $sql) or die( "ERREUR MYSQL numéro: ".mysql_errno()."<br>Type de cette erreur: ".mysql_error()."<br>\n" );
    //récupération avec mysql_fetch_array(), et affichage de nos résultats :
    while( $result = mysql_fetch_array( $requete ) )
    {
    //sondage aprés validation sans bouton
    if ($num > 1) {
     
    echo '<img src="img/_sondage.gif"><br>';
     
    echo '<div class="archives">'.$infos['question'].'</div>'.''. "";
    if( round($pourcentage_r1) != 0){
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1"><img src="img/sondage/vert.gif" height="16" width="' .$pourcentage_r1 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r1).'%" /> ' . round($pourcentage_r1)  . "% (".$result["resultats1"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats1"].' vote)<br /></div>';}
    if( round($pourcentage_r2) != 0){
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.'' .'<div class="date1"><img src="img/sondage/rouge.gif" height="16" width="' . $pourcentage_r2 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r2).'%" /> ' . round($pourcentage_r2)  . "% (".$result["resultats2"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition2'].'</div>'.'' .'<div class="date1">('.$result["resultats2"].' vote)<br /></div>';}
     
     if ($infos['proposition3'] != "")
     if( round($pourcentage_r3) != 0){
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.'' .'<div class="date1"><img src="img/sondage/orange.gif" height="16" width="' . $pourcentage_r3 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r3).'%" /> ' . round($pourcentage_r3)  . "% (".$result["resultats3"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition3'].'</div>'.'' .'<div class="date1">('.$result["resultats3"].' vote)<br /></div>';}
     
           if ($infos['proposition4'] != "")
    if( round($pourcentage_r4) != 0){
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.'' .'<div class="date1"><img src="img/sondage/jaune.gif" height="16" width="' . $pourcentage_r4 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r4).'%" /> ' . round($pourcentage_r4)  . "% (".$result["resultats4"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition4'].'</div>'.'' .'<div class="date1">('.$result["resultats4"].' vote)<br /></div>';}
     
    	        if ($infos['proposition5'] != "")
    if( round($pourcentage_r5) != 0){
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.'' .'<div class="date1"><img src="img/sondage/bleu.gif" height="16" width="' . $pourcentage_r5 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r5).'%" /> ' . round($pourcentage_r5)  . "% (".$result["resultats5"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition5'].'</div>'.'' .'<div class="date1">('.$result["resultats5"].' vote)<br /></div>';}
     
    echo '<div align="right" class="archive"><a href="index.php?rub=game-editor">les résultats des anciens sondages +</a></div>';
    echo '<br/><br/><br/><br/><br/>';
    }
     else {
     
    //sondage avec bouton avant validation
    echo '<img src="img/_sondage.gif"><br>';
     
    echo '<div class="archives">'.$infos['question'].'</div>'.''. "";
    if( round($pourcentage_r1) != 0){
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.''.  "<input type='radio' name='sondage' value='prop1' id='prop1' /> <label for='prop1'>" .'<img src="img/sondage/vert.gif" height="16" width="' . $pourcentage_r1 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r1).'%" />' . '<img src="img/sondage/vert_droite.gif"/> ' . round($pourcentage_r1) . "% (".$result["resultats1"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.''.  "<input type='radio' name='sondage' value='prop1' id='prop1' /> <label for='prop1'>" .'<span class="date1">('.$result["resultats1"].' vote)<br /></span>';}
     
    if( round($pourcentage_r2) != 0){
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.''.  "<input type='radio' name='sondage' value='prop2' id='prop2' /> <label for='prop2'>" .'<img src="img/sondage/rouge.gif" height="16" width="' . $pourcentage_r2 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r2).'%" /> ' . round($pourcentage_r2) . "% (".$result["resultats2"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.''.  "<input type='radio' name='sondage' value='prop2' id='prop2' /> <label for='prop2'>" .'<span class="date1">('.$result["resultats2"].' vote)<br /></span>';}
     
     
     if ($infos['proposition3'] != "")
    if( round($pourcentage_r3) != 0){
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.''.  "<input type='radio' name='sondage' value='prop3' id='prop3' /> <label for='prop3'>" .'<img src="img/sondage/jaune.gif" height="16" width="' . $pourcentage_r3 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r3).'%" /> ' . round($pourcentage_r3) . "% (".$result["resultats3"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.''.  "<input type='radio' name='sondage' value='prop3' id='prop3' /> <label for='prop3'>" .'('.$result["resultats3"].' vote)<br />';}
     
     
           if ($infos['proposition4'] != "")
    if( round($pourcentage_r4) != 0){
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.''.  "<input type='radio' name='sondage' value='prop4' id='prop4' /> <label for='prop4'>" .'<img src="img/sondage/orange.gif" height="16" width="' . $pourcentage_r4 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r4).'%" /> ' . round($pourcentage_r4) . "% (".$result["resultats4"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.''.  "<input type='radio' name='sondage' value='prop4' id='prop4' /> <label for='prop4'>" .'('.$result["resultats4"].' vote)<br />';}
     
     
    	        if ($infos['proposition5'] != "")
    if( round($pourcentage_r5) != 0){
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.''.  "<input type='radio' name='sondage' value='prop5' id='prop5' /> <label for='prop5'>" .'<img src="img/sondage/bleu.gif" height="16" width="' . $pourcentage_r5 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r5).'%" /> ' . round($pourcentage_r5) . "% (".$result["resultats5"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.''.  "<input type='radio' name='sondage' value='prop5' id='prop5' /> <label for='prop5'>" .'<span class="date1">('.$result["resultats5"].' vote)</span>';}
     
    echo '<br /><input type="submit" name="voter" value="Voter !"/><br /><br />';
    echo '<div align="right" class="archive"><a href="index.php?rub=game-editor">les résultats des anciens sondages +</a></div>';
    echo '<br/><br/>';
    }
    }
    }
    merci de votre aide

  5. #5
    Membre confirmé
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    504
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2008
    Messages : 504
    Points : 470
    Points
    470
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats1"].($result["resultats1"] > 1 ? 'votes' : 'vote').')<br /></div>';}

  6. #6
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    284
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 284
    Points : 62
    Points
    62
    Par défaut
    Merci beaucoup
    pour mon erreur ip, qqn aura la gentillesse de me montrer , je suis tout perdu et j'aimerais bien voir comment on peut faire? please please please

  7. #7
    Membre confirmé
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2008
    Messages
    504
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2008
    Messages : 504
    Points : 470
    Points
    470
    Par défaut
    Elle dit quoi ton erreur ?

    C'est une erreur MySQL ou juste que ça ne marche pas ?

  8. #8
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    284
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 284
    Points : 62
    Points
    62
    Par défaut
    le probléme c'est que ca ne marche pas.
    une fois une ip de rentrer, cela empeche un nouveau vote, le but est de bloqué une ip par sondage.

    je ne vois pas le probleme et ca resolution:

    code de la page:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
     
    if(isset($_POST['sondage'])){
        $vote_ip = $_SERVER['REMOTE_ADDR'];
        $sondage_id = $numeroDuSondage['nbre_entrees'];
        $sql = "INSERT INTO t_vote (sondage_id, vote_ip) VALUES ($sondage_id, '$vote_ip')";
        mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
     
     
    }
    $query = "SELECT vote_ip FROM t_vote WHERE sondage_id='.$sondage_id.'  " ;
    $result = mysql_query($query);
    $num = mysql_num_rows($result);
     
    ?>
    <br />
     
    <form method="post" name="sondage" >
    <?php
    $sql = "SELECT resultats1,resultats2,resultats3,resultats4, resultats5 FROM ".$table." WHERE id="."'" . $numeroDuSondage['nbre_entrees'] . "' ";
    //exécution de notre requête SQL:
    $requete = mysql_query( $sql) or die( "ERREUR MYSQL numéro: ".mysql_errno()."<br>Type de cette erreur: ".mysql_error()."<br>\n" );
    //récupération avec mysql_fetch_array(), et affichage de nos résultats :
    while( $result = mysql_fetch_array( $requete ) )
    {
    //sondage aprés validation sans bouton
    if ($num > 0) {
     
    echo '<img src="img/_sondage.gif"><br>';
     
    echo '<div class="archives">'.$infos['question'].'</div>'.''. "";
    if( round($pourcentage_r1) != 0){
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1"><img src="img/sondage/vert.gif" height="16" width="' .$pourcentage_r1 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r1).'%" /> ' . round($pourcentage_r1)  . "% (".$result["resultats1"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats1"].($result["resultats1"] > 1 ? 'votes' : 'vote').')<br /></div>';}
     
    if( round($pourcentage_r2) != 0){
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.'' .'<div class="date1"><img src="img/sondage/rouge.gif" height="16" width="' . $pourcentage_r2 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r2).'%" /> ' . round($pourcentage_r2)  . "% (".$result["resultats2"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats2"].($result["resultats2"] > 1 ? 'votes' : 'vote').')<br /></div>';}
     
     
     if ($infos['proposition3'] != "")
     if( round($pourcentage_r3) != 0){
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.'' .'<div class="date1"><img src="img/sondage/orange.gif" height="16" width="' . $pourcentage_r3 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r3).'%" /> ' . round($pourcentage_r3)  . "% (".$result["resultats3"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats3"].($result["resultats3"] > 1 ? 'votes' : 'vote').')<br /></div>';}
     
     
           if ($infos['proposition4'] != "")
    if( round($pourcentage_r4) != 0){
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.'' .'<div class="date1"><img src="img/sondage/jaune.gif" height="16" width="' . $pourcentage_r4 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r4).'%" /> ' . round($pourcentage_r4)  . "% (".$result["resultats4"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats4"].($result["resultats4"] > 1 ? 'votes' : 'vote').')<br /></div>';}
     
     
    	        if ($infos['proposition5'] != "")
    if( round($pourcentage_r5) != 0){
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.'' .'<div class="date1"><img src="img/sondage/bleu.gif" height="16" width="' . $pourcentage_r5 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r5).'%" /> ' . round($pourcentage_r5)  . "% (".$result["resultats5"]." vote)</div>";
    }else{
    echo '<div class="date">'.$infos['proposition1'].'</div>'.'' .'<div class="date1">('.$result["resultats5"].($result["resultats5"] > 1 ? 'votes' : 'vote').')<br /></div>';}
     
     
    echo '<div align="right" class="archive"><a href="index.php?rub=game-editor">les résultats des anciens sondages +</a></div>';
    echo '<br/><br/><br/><br/><br/>';
    }
     else {
     
    //sondage avec bouton avant validation
    echo '<img src="img/_sondage.gif"><br>';
     
    echo '<div class="archives">'.$infos['question'].'</div>'.''. "";
    if( round($pourcentage_r1) != 0){
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.''.  "<input type='radio' name='sondage' value='prop1' id='prop1' /> <label for='prop1'>" .'<img src="img/sondage/vert.gif" height="16" width="' . $pourcentage_r1 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r1).'%" />' . '<img src="img/sondage/vert_droite.gif"/> ' . round($pourcentage_r1) . "% (".$result["resultats1"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition1'].'</div>'.''.  "<input type='radio' name='sondage' value='prop1' id='prop1' /> <label for='prop1'>" .'<span class="date1">('.$result["resultats1"].' vote)<br /></span>';}
     
    if( round($pourcentage_r2) != 0){
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.''.  "<input type='radio' name='sondage' value='prop2' id='prop2' /> <label for='prop2'>" .'<img src="img/sondage/rouge.gif" height="16" width="' . $pourcentage_r2 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r2).'%" /> ' . round($pourcentage_r2) . "% (".$result["resultats2"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition2'].'</div>'.''.  "<input type='radio' name='sondage' value='prop2' id='prop2' /> <label for='prop2'>" .'<span class="date1">('.$result["resultats2"].' vote)<br /></span>';}
     
     
     if ($infos['proposition3'] != "")
    if( round($pourcentage_r3) != 0){
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.''.  "<input type='radio' name='sondage' value='prop3' id='prop3' /> <label for='prop3'>" .'<img src="img/sondage/jaune.gif" height="16" width="' . $pourcentage_r3 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r3).'%" /> ' . round($pourcentage_r3) . "% (".$result["resultats3"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition3'].'</div>'.''.  "<input type='radio' name='sondage' value='prop3' id='prop3' /> <label for='prop3'>" .'('.$result["resultats3"].' vote)<br />';}
     
     
           if ($infos['proposition4'] != "")
    if( round($pourcentage_r4) != 0){
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.''.  "<input type='radio' name='sondage' value='prop4' id='prop4' /> <label for='prop4'>" .'<img src="img/sondage/orange.gif" height="16" width="' . $pourcentage_r4 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r4).'%" /> ' . round($pourcentage_r4) . "% (".$result["resultats4"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition4'].'</div>'.''.  "<input type='radio' name='sondage' value='prop4' id='prop4' /> <label for='prop4'>" .'('.$result["resultats4"].' vote)<br />';}
     
     
    	        if ($infos['proposition5'] != "")
    if( round($pourcentage_r5) != 0){
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.''.  "<input type='radio' name='sondage' value='prop5' id='prop5' /> <label for='prop5'>" .'<img src="img/sondage/bleu.gif" height="16" width="' . $pourcentage_r5 / 100 * $long_max_bloc . '" alt="'.round($pourcentage_r5).'%" /> ' . round($pourcentage_r5) . "% (".$result["resultats5"]."vote)";
    }else{
    echo  '<div class="date">'.$infos['proposition5'].'</div>'.''.  "<input type='radio' name='sondage' value='prop5' id='prop5' /> <label for='prop5'>" .'<span class="date1">('.$result["resultats5"].' vote)</span>';}
     
    echo '<br /><input type="submit" name="voter" value="Voter !"/><br /><br />';
    echo '<div align="right" class="archive"><a href="index.php?rub=game-editor">les résultats des anciens sondages +</a></div>';
    echo '<br/><br/>';
    }
    }
    }

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    284
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 284
    Points : 62
    Points
    62
    Par défaut
    bonjour à tous,

    Pour mon problème précédent, la solution était une restriction dans la bdd. ( pour ceux qui chercherons le même problème)
    J'aimerais obtenir votre aide sur un autre type de problème...
    Lorsque je vote grâce à un formulaire type radio et je clique de la seconde et avant dernière réponse, le formulaire envoi bien la réponse mais affiche le dernier bouton à chaque fois mais valide bien la réponse sélectionné, pour un côté esthetique j'aimerais bien qui n'aille pas sur le dernier bouton....

    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
     
    echo '<img src="img/_sondage.gif"><br>';
    echo '<div class="archives">'.stripslashes($infos['question']).'</div>'.''. "";
    if( round($pourcentage_r1) != 0){
    echo  '<div class="date">'.stripslashes($infos['proposition1']).'</div>'.'' .'<div class="date1"><img src="img/sondage/vert.gif" height="16" width="' .$pourcentage_r1 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r1).'%" /> ' . round($pourcentage_r1)  . "% (".$result["resultats1"].($result["resultats1"] > 1 ? ' votes ' : ' vote').")</div>";
    }else{
    echo '<div class="date">'.stripslashes($infos['proposition1']).'</div>'.'' .'<div class="date1">('.$result["resultats1"].($result["resultats1"] > 1 ? ' votes ' : ' vote').')<br /></div>';}
     
    if( round($pourcentage_r2) != 0){
    echo  '<div class="date">'.stripslashes($infos['proposition2']).'</div>'.'' .'<div class="date1"><img src="img/sondage/rouge.gif" height="16" width="' . $pourcentage_r2 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r2).'%" /> ' . round($pourcentage_r2)  . "% (".$result["resultats2"].($result["resultats2"] > 1 ? ' votes ' : ' vote').")</div>";
    }else{
    echo '<div class="date">'.stripslashes($infos['proposition2']).'</div>'.'' .'<div class="date1">('.$result["resultats2"].($result["resultats2"] > 1 ? ' votes ' : ' vote').')<br /></div>';}
     
     
     if ($infos['proposition3'] != "")
     if( round($pourcentage_r3) != 0){
    echo  '<div class="date">'.stripslashes($infos['proposition3']).'</div>'.'' .'<div class="date1"><img src="img/sondage/orange.gif" height="16" width="' . $pourcentage_r3 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r3).'%" /> ' . round($pourcentage_r3)  . "% (".$result["resultats3"].($result["resultats3"] > 1 ? ' votes ' : ' vote').")</div>";
    }else{
    echo '<div class="date">'.stripslashes($infos['proposition3']).'</div>'.'' .'<div class="date1">('.$result["resultats3"].($result["resultats3"] > 1 ? ' votes ' : ' vote').')<br /></div>';}
     
     
           if ($infos['proposition4'] != "")
    if( round($pourcentage_r4) != 0){
    echo  '<div class="date">'.stripslashes($infos['proposition4']).'</div>'.'' .'<div class="date1"><img src="img/sondage/jaune.gif" height="16" width="' . $pourcentage_r4 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r4).'%" /> ' . round($pourcentage_r4)  . "% (".$result["resultats4"].($result["resultats4"] > 1 ? ' votes ' : ' vote').")</div>";
    }else{
    echo '<div class="date">'.stripslashes($infos['proposition4']).'</div>'.'' .'<div class="date1">('.$result["resultats4"].($result["resultats4"] > 1 ? ' votes ' : ' vote').')<br /></div>';}
     
     
    	        if ($infos['proposition5'] != "")
    if( round($pourcentage_r5) != 0){
    echo  '<div class="date">'.stripslashes($infos['proposition5']).'</div>'.'' .'<div class="date1"><img src="img/sondage/bleu.gif" height="16" width="' . $pourcentage_r5 / 100 * $long_max_bloc . '" alt=" '.round($pourcentage_r5).'%" /> ' . round($pourcentage_r5)  . "% (".$result["resultats5"].($result["resultats5"] > 1 ? ' votes ' : ' vote').")</div>";
    }else{
    echo '<div class="date">'.stripslashes($infos['proposition1']).'</div>'.'' .'<div class="date1">('.$result["resultats5"].($result["resultats5"] > 1 ? ' votes ' : ' vote').')<br /></div>';}
    merci pour tous!
    sam!

Discussions similaires

  1. [PL/SQL] Supprimer les caractères non numériques
    Par Oliveuh dans le forum PL/SQL
    Réponses: 6
    Dernier message: 25/06/2015, 12h13
  2. SQL et GUID : Valeur de caractère non valide pour la ....
    Par jackfirst72 dans le forum Bases de données
    Réponses: 5
    Dernier message: 06/03/2007, 10h46
  3. [JDBC]Caractère non-valide
    Par calimero82 dans le forum JDBC
    Réponses: 2
    Dernier message: 16/02/2005, 14h22
  4. [CR] envoyer un caractère non imprimable
    Par nnj dans le forum SAP Crystal Reports
    Réponses: 1
    Dernier message: 27/07/2004, 08h56
  5. Creation de table, caractère non reconnu
    Par Missvan dans le forum PostgreSQL
    Réponses: 2
    Dernier message: 17/02/2004, 13h28

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