|
| Anonyme | Posté le 09/12/2006 @ 17:03 |
Petit astucien
356 Messages
| bonjour en herchant sur googler j'ai trouve un sondage personalisé avec le code http://www.creation-du-web.com/honolulu/cours-html-javascript-cre_sond.html j'ai mis sondage.php <td width="784" colspan="2" bgcolor="#330099">Question :<br> <br> "L'arc cosinus, c'est une herbe aromatique ?" <form name="formulaire" method="post" action="<?$PHP_SELF;?>"> <input type="radio" name="choix" value="oui"> oui... <br> <input type="radio" name="choix" value="non"> non... <br> <input type="radio" name="choix" value="pas"> ne sait pas...<br> <br> <input type="submit" value="Validez votre réponse"> <br> </form> <? switch($choix) { case "oui": $fichier = fopen("sondage/oui.txt","r+"); $sond = fgets($fichier,255); $sond++;fclose($fichier); $fichier = fopen("sondage/oui.txt","w"); fwrite($fichier,$sond); fclose($fichier);break; case "non": $fichier = fopen("sondage/non.txt","r+"); $sond = fgets($fichier,255); $sond++;fclose($fichier); $fichier = fopen("sondage/non.txt","w"); fwrite($fichier,$sond); fclose($fichier);break; case "pas": $fichier = fopen("sondage/pas.txt","r+"); $sond = fgets($fichier,255); $sond++;fclose($fichier); $fichier = fopen("sondage/pas.txt","w"); fwrite($fichier,$sond); fclose($fichier);break; } ?></td> </tr> </table> <p> </p></TD> </TR> </TBODY> </TABLE> </body> </html>
sondage/resultat.php <? $fichier = fopen("oui.txt","r"); $sonda = fgets($fichier,255); fclose($fichier); $fichier = fopen("non.txt","r"); $sondb = fgets($fichier,255); fclose($fichier); $fichier = fopen("pas.txt","r"); $sondc = fgets($fichier,255); fclose($fichier); $tot_sond=($sonda+$sondb+$sondc); echo "Nombre de \"oui\" : ",$sonda; echo "Nombre de \"non\" : ",$sondb; echo "Nombre de \"ne sait pas\" : ",$sondc; echo "Nombre total de votes : ",$tot_sond; ?>
et j'ai fiat un dossier sondage avec 3 fichiers en extension .text oui.test non.text .pas.text j'ai un probleme quand je clique sur envoye il met pas les résultats http://le.coffre.free.fr/sondage.php je pense j'ai oublie un bout de code tu peux me dire lequel merci
|
| |
| |
| Publicité |
|
|
| lebendre | Posté le 10/12/2006 à 16:29 |
Petit astucien
154 Messages
| tu es sûr qu'il ne faut pas mettre plutôt oui.txt, non.txt et pas.txt (et pas "text" comme proposé dans ton message!) |
| |
|
| Anonyme | Posté le 10/12/2006 à 16:43 |
Petit astucien
356 Messages
| tu ma fait doutai mais j'ai bien mis .txt j'ai mis texte car j'ecris comme ca et pas txt dc desolé de mon erreur mais ca ne marche pas |
| |
|
| Anonyme | Posté le 10/12/2006 à 16:55 |
Petit astucien
356 Messages
| j'ai trouve http://le.coffre.free.fr/sondage.php qd tu clique sur envoyé ca charge pas donc il fdat cliquer sur resultat que j'ai fait un lien pour voir les resultats http://le.coffre.free.fr/resultat.php mais par ocntre c'est tout collé les resultats j'ai essayé de faire un saute ligne mais apres il dit erreur es ce que tu pourais me faire un results propre <? $fichier = fopen("sondage/oui.txt","r"); $sonda = fgets($fichier,255); fclose($fichier); $fichier = fopen("sondage/non.txt","r"); $sondb = fgets($fichier,255); fclose($fichier); $fichier = fopen("sondage/pas.txt","r"); $sondc = fgets($fichier,255); fclose($fichier); $tot_sond=($sonda+$sondb+$sondc); echo "Nombre de \"oui\" : ",$sonda; echo "Nombre de \"non\" : ",$sondb; echo "Nombre de \"ne sait pas\" : ",$sondc; echo "Nombre total de votes : ",$tot_sond; ?>
merci Modifié par Anonyme le 10/12/2006 16:57 |
| |
|
| lebendre | Posté le 10/12/2006 à 17:33 |
Petit astucien
154 Messages
| $tot_sond=($sonda+$sondb+$sondc); echo "Nombre de \"oui\" : ".$sonda.'<br>'; echo "Nombre de \"non\" : ".$sondb.'<br>'; echo "Nombre de \"ne sait pas\" : ".$sondc.'<br>'; echo "Nombre total de votes : ".$tot_sond; Mais tu devrais lire quelques tutoriels php avant de toucher au code, sinon tu vas faire n'importe quoi et puis comme ça tu comprendras aussi un peu ce que tu fais |
| |
|
| Anonyme | Posté le 10/12/2006 à 17:40 |
Petit astucien
356 Messages
| tinkikete pas je commence a comprendre un peux en 7 mois lol juste une question qd je vais recree un sondage avec tres bien moche nul jez devrais mettre tresbien.txt pour qu'il puisse comprendre ps : on peux cree un message en disant merci d'avoir voté car là si on clique on ne sait pas si ca marche il faudras quon cliqsue on mt un message es ce que il faut mettre ou le message pour juste dire merci d'avoir voté merci Modifié par Anonyme le 10/12/2006 17:50 |
| |
|
| El Konkonbré M@squed | Posté le 10/12/2006 à 20:48 |
Petit astucien
355 Messages
| Salut $tot_sond=($sonda+$sondb+$sondc); echo "Nombre de \"oui\" : ".$sonda.'<br>'; echo "Nombre de \"non\" : ".$sondb.'<br>'; echo "Nombre de \"ne sait pas\" : ".$sondc.'<br>'; echo "Nombre total de votes : ".$tot_sond;
Le code ci-dessous serait meilleur $tot_sond = ($sonda + $sondb + $sondc); echo 'Nombre de "oui" : '.$sonda.'<br>'; echo 'Nombre de "non" : '.$sondb.'<br>'; echo 'Nombre de "ne sait pas" : '.$sondc.'<br>'; echo 'Nombre total de votes : '.$tot_sond;
Bye. |
| |
|
| Anonyme | Posté le 14/12/2006 à 05:31 |
Petit astucien
356 Messages
| bonjour j'ai un probleme quand je clique sur tres bien et=je clique sur envoyer http://le.coffre.free.fr/sondage.php et quand je clique sur visualisé il me comptabilise pas les votes et une petite chose es ce que c'est possible de mettre une barre de different couleur pour chaque réponse et aussi pour mettre mes includes menuhaut menu gauche ca beugue pourtemp sondage.php <TD vAlign=top align=left colSpan=2 height=113><?php include("menuhaut.php"); ?></TD> </TR> <TR> <TD vAlign=top align=left width=150 height=395><?php include("menugauche.php"); ?></TD> <TD width="680" height=395 align=left vAlign=top><br /> <table cellspacing="0" cellpadding="0" width="650" align="center"> <tbody> <tr> <td valign="top" align="center" width="650" bgcolor="black"><span class="Style5">Sondage</span></td> </tr> <tr> <td valign="top" align="center" width="650" height="131"><br> Comment Vous trouvé mon site?" <br /> <br /> <table width="200" align="center"> <tr> <td width="200" align="left" valign="top"><form action="<?$PHP_SELF;?>" method="post" name="formulaire" id="formulaire"> <p> <input type="radio" name="choix" value="Trés bien" /> Trés bien<br /> <input type="radio" name="choix" value="Bien" /> Bien <br /> <input type="radio" name="choix" value="Moyen" /> Moyen<br /> <input type="radio" name="choix" value="bof" /> bof <br /> <br /> <input name="submit" type="submit" value="Voté" /> <br /> </p> </form></td> </tr> </table> <br /> <a href="sondage/resultat.php">Les résultats </a> <p> </p> <p> </p></td> </tr> </table> <p> </p></TD> </TR> </TBODY> </TABLE> </body> </html>
resultat.php <TABLE height=960 cellSpacing=0 cellPadding=0 width=980 align=center> <TBODY> <TR> <TD vAlign=top align=left colSpan=2 height=113><?php include("sondage/menuhaut.php"); ?></TD> </TR> <TR> <TD vAlign=top align=left width=150 height=395><?php include("sondage/menugauche.php"); ?></TD> <TD width="680" height=395 align=left vAlign=top><br /> <table cellspacing="0" cellpadding="0" width="650" align="center" border="1"> <tbody> <tr> <td valign="top" align="center" width="650" bgcolor="black"><span class="Style5">R&sultat</span></td> </tr> <tr> <td valign="top" align="center" width="650" height="131"><br /> <table width="200" align="center"> <tr> <td width="200" align="left" valign="top"><? $fichier = fopen("premiersondage/tresbien.txt","r"); $sonda = fgets($fichier,255); fclose($fichier); $fichier = fopen("premiersondage/bien.txt","r"); $sondb = fgets($fichier,255); fclose($fichier); $fichier = fopen("premiersondage/moyen.txt","r"); $sondc = fgets($fichier,255); fclose($fichier); $fichier = fopen("premiersondage/bof.txt","r"); $sondc = fgets($fichier,255); fclose($fichier); $tot_sond=($sonda+$sondb+$sondc); echo "Nombre de \"tresbien\" : ",$sonda.'<br>'; echo "Nombre de \"bien\" : ",$sondb.'<br>'; echo "Nombre de \"moyen\" : ",$sondc.'<br>'; echo "Nombre de \"bof\" : ",$sondc.'<br>'; echo "Nombre total de votes : ",$tot_sond; ?>
merci Modifié par Anonyme le 14/12/2006 05:34 |
| |
|
|
| Haut de la page |