script © 2013 by webdesign weisshart |
|
So sieht´s aus |
Wie gefällt dir HKH? |
|
<html>
<head> <style type="text/css">Hier nichts</style> </head> <body > <script> function getVote(int) { var xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if (this.readyState==4 && this.status==200) { document.getElementById("poll").innerHTML=this.responseText; } } xmlhttp.open("GET","../Extra/voteresults.php?vote="+int,true); xmlhttp.send(); } </script> <div id="poll"> <h3>Wie gefällt dir HKH?</h3> <form> Sehr gut: <input type="radio" name="vote" value="0" onclick="getVote(this.value)"><br> Nicht so: <input type="radio" name="vote" value="1" onclick="getVote(this.value)"> </form> </div> </body> </html> |
|
<html>
<head> <style type="text/css">Hier nichts</style> </head> <body > <?php $vote = $_REQUEST['vote']; //get content of textfile $filename = "../Extra/txt/vote.txt"; $content = file($filename); //put content in array $array = explode("||", $content[0]); $yes = $array[0]; $no = $array[1]; if ($vote == 0) { $yes = $yes + 1; } if ($vote == 1) { $no = $no + 1; } //insert votes to txt file $insertvote = $yes."||".$no; $fp = fopen($filename,"w"); fputs($fp,$insertvote); fclose($fp); ?> <h2>Ergebnis:</h2> <table> <tr> <td>Sehr gut:</td> <td><img style="height:10px" src="../Bilder/Gold.jpg" width='<?php echo(100*round($yes/($no+$yes),2)); ?>' height='20'> <?php echo(100*round($yes/($no+$yes),2)); ?>% </td> </tr> <tr> <td>Nicht so:</td> <td><img style="height:10px" src="../Bilder/Gold.jpg" width='<?php echo(100*round($no/($no+$yes),2)); ?>' height='20'> <?php echo(100*round($no/($no+$yes),2)); ?>% </td> </tr> </table> </body> </html> |
|
0||0
|
Kontakt Datenschutz Impressum |