<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >x{float:Left ;}#Top{width:500px; Height:150px;}#Bottom{width:500px; Height:150px; Display:none;}#Fanhui{display:none;}</style>PHPinclude("dbda.class.php");$db=NewDbda ();$stm= "SELECT * from Diaoyantimu limit 0,1";$ATM=$db->query ($stm); Echo"<div> Title name: {$ATM[0] [1]} </div> ";$sxx= "SELECT * from Diaoyanxuanxiang where timudaihao= ' {$ATM[0] [0]} ' ";$axx=$db->query ($sxx);Echo"<div id= ' top ' >";foreach($axx as $v){ Echo"<div><input type= ' checkbox ' value= ' {$v[0]} ' name= ' xx[] '/>{$v[1]} </div> ";}Echo"</div>";?><!--Show Results--><div id= "Bottom" ><?PHP$sum="select sum (numbers) from Diaoyanxuanxiang where timudaihao= ' {$ATM[0] [0]} ' ";$asum=$db->query ($sum);$total=$asum[0] [0];foreach($axx as $v){ $BFB=($v[2]/$total) *100; Echo"<div><span class= ' x ' >{$v[1]}</span> <div class= ' x ' style= ' border:1px solid black; width:120px; height:12px; ' > <div style= ' background-color:red;height:12px;width:{$BFB}% ' > </div> </div> <span class= ' x ' > {$v[2]} </span> <span class= ' x ' >{$BFB}%</span> </div> <div style= ' Clear:both ' ></div>"; }></div><div id= "Anniu" ><input type= "Submit" value= "submit"/><input type= "button" value= "View" Onclick= "Showresult ()"/></div><div id= "Fanhui" ><input type= "button" value= "Return" onclick= "show ()"/ ></div></form></body><script type= "Text/javascript" >functionShowresult () {document. getElementById ("Top"). Style.display= "None"; Document. getElementById ("Bottom"). Style.display= "Block"; Document. getElementById ("Fanhui"). Style.display= "Block"; Document. getElementById ("Anniu"). style.display= "None"; }functionShow () {document. getElementById ("Top"). Style.display= "Block"; Document. getElementById ("Bottom"). style.display= "None"; Document. getElementById ("Fanhui"). style.display= "None"; Document. getElementById ("Anniu"). Style.display= "Block"; }</script>View Code<?PHP$ids=$_post["XX"];include("dbda.class.php");$db=NewDbda ();foreach($ids as $v){ $sql="Update Diaoyanxuanxiang set numbers=numbers+1 where ids= ' {$v}‘"; $db->query ($sql, 0);}Header("location:lianxi.php");View CodePHP Voting system Exercises