The ability to poll, show the percentage of people

Source: Internet
Author: User

<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >{margin:0px Auto; Padding:0px; }.title{Height:50px; Margin:20px 0px 0px 20px;}.List{width:300px; Height:200px; Margin-left:20px;}.xx{Width:300px; Height:30px;}.jieguo{Width:300px; Height:200px; Margin-left:20px;}.xxnr{Width:300px; Height:30px;}</style>PHPinclude("dbda.php"); $db=NewDbda (); $sql= "SELECT * FROM Diaoyantimu"; $result=$db->query ($sql); //Topic title        Echo"<div class= ' title ' >{$result[0] [1]} </div> "; $code=$result[0] [0]; $SQLX= "SELECT * from Diaoyanxuanxiang where Timudaihao = {$code}"; $resultx=$db->query ($SQLX); $xian= ""; if(@$_get["BS"]==1)        {            $xian= "Display:none"; }        Else        {            $xian= "Display:block"; }                //div for topic options        Echo"<div class= ' list ' style= ' {$xian} ' > ';  for($i= 0;$i<Count($resultx);$i++)        {            Echo"<div class= ' xx ' >"; Echo"<input type= ' checkbox ' value= ' {$resultx[$i][0]} ' name= ' opt[] '/> '; Echo"<span>{$resultx[$i][1]}</span> "; Echo"</div>"; }        Echo"</div>"; //here's the DIV for the poll results        $xianshi= ""; if(@$_get["BS"]==1)        {            $xianshi= "Display:block"; }        Else        {            $xianshi= "Display:none"; }        Echo"<div class= ' Jieguo ' style= ' {$xianshi} ' > '; //total number of people seeking        $sqlcount= "Select sum (Numbers) from Diaoyanxuanxiang"; $attrcount=$db->query ($sqlcount);  for($j= 0;$j<Count($resultx);$j++)        {            $rs=$resultx[$j][2]; if($attrcount[0] [0]==0)            {                $BFB= 0; }            Else            {                $BFB= ($rs/$attrcount[0] [0]) *100; }                        Echo"<div class= ' Xxnr ' >"; Echo"<span style= ' Float:left ' >{$resultx[$j][1]}</span> "; Echo"<div style= ' float:left;margin:10px 0px 0px 10px;width:100px, height:4px, border:1px solid #000 ' > < Div style= ' width:{$BFB}%; height:4px;margin-left:0px; Background-color: #666 ' ></div> </div>"; Echo"<span style= ' float:left; margin-left:10px ' >{$resultx[$j][2]}</span> "; Echo"</div>"; }                                Echo"</div>"; ?> <div style= "margin-left:20px; width:200px "> <input id=" TJ "type=" submit "style=" float:left;<?php Echo$xian;? >;margin:0px 0px 0px 10px "value=" Submit "/> <input id=" FH "type=" button "style=" float:left;<?php Echo$xianshi;? >;margin:0px 0px 0px 10px "onclick=" SHOWTP () "value=" return "/> <input type=" button "style=" Float:left;display : block;margin:0px 0px 0px 10px "onclick=" Showjieguo () "value=" Show results "/> </div> </form></body>&lt Script type= "Text/javascript" >functionShowjieguo () {var List= Document.getelementsbyclassname ("list"); varJieguo = Document.getelementsbyclassname ("Jieguo"); varTJ = document.getElementById ("TJ")); varFH = document.getElementById ("FH"); FH. style.display= "Block"; TJ. style.display= "None"; List[0].style.display= "None"; jieguo[0].style.display = "Block";}functionSHOWTP () {var List= Document.getelementsbyclassname ("list"); varJieguo = Document.getelementsbyclassname ("Jieguo"); varTJ = document.getElementById ("TJ")); varFH = document.getElementById ("FH"); FH. style.display= "None"; TJ. style.display= "Block"; List[0].style.display= "Block"; jieguo[0].style.display = "None";}</script>

chuli.php

<?PHPinclude("dbda.php");$db=NewDbda ();$attr=$_post["Opt"]; for($i= 0;$i<Count($attr);$i++){        $sql= "Update Diaoyanxuanxiang set Numbers = numbers+1 where Ids = {$attr[$i]}"; $db->query ($sql, 0);}Header("Location:test.php?bs=1");

The ability to poll, show the percentage of people

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.