Voting Interface Code
PHPinclude"Function/unionsql-function.php";if(isset($_post[' Submit ']) &&isset($_post[' ATR '])){ $atr=$_post[' ATR ']; foreach($atr as $i) { $s 3= "Select number from dy where code=$i[0] "; $s 3=unionsql ($s 3); $s 3=$s 3[0] [0]+1; $s 4= "Update dy set number=$s 3where code=$i[0] "; $s 4=unionsql ($s 4); }}$ssum= "Select sum (number) from Dy";$ssum=unionsql ($ssum);$s 1= "SELECT * FROM Dytitle";$s 1=unionsql ($s 1);if($s 1[0] [2]==1) $type= "checkbox";Else $type= "Radio";$s 2= "Select * from Dy where titleid={$s 1[0] [0]} ";$s 2=unionsql ($s 2);?><div> Title: <?phpEcho $s 1[0] [1] ></div><div id= ' a ' style= "display:block;" ><form action= ' method= ' post ' ><?PHPEcho"<table>";foreach($s 2 as $i){ Echo"<tr> <td><input type=$typeValue= '$i[0] ' name= ' atr[] '/></td> <td>$i[1]</td> </tr>";}Echo"</table>";><input type= "Submit" value= "submitted" name= "Submission"/> <input type= "button" value= "poll result" onclick= "ck ()"/></form></div><div id= "B" style= "Display:none ;" ><?PHPEcho"<table>";foreach($s 2 as $i){ $snumber= "Select number from dy where code=$i[0] "; $snumber=unionsql ($snumber); $j=round($snumber[0] [0]/$ssum[0] [0]*100]. " %"; Echo"<tr> <td>$i[1]</td> <td>$i[2]</td> <td> <div style= ' width:150px; height:10px; Background-color: #666; ' > <div style= ' width:{$j}; height:10px; Background-color: #F00; ' ></div> </div> </td> <td>$j</td> </tr>";}Echo"</table>";><input type= "button" value= "return poll" onclick= "FH ()"/></div></body>functionck () {varA=document.getelementbyid (' a '); varB=document.getelementbyid (' B '); A. style.display= "None"; b. style.display= "Block";}functionFH () {document. getElementById ("a"). Style.display= "Block"; Document. getElementById ("B"). style.display= "None"; }</script>
62nd Day Rest Simple voting interface