投票
2016-05-25 18:51
169 查看
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> #list{ width:250px; height:200px} #jieguo{width:250px; height:200px} .x{float:left} </style> </head> <body> <form action="chuli.php" method="post"> <?php include("../DBDA.class.php"); $db = new DBDA(); $sql = "select * from diaoyantimu limit 0,1"; $attr = $db->Query($sql); $tmmc = $attr[0][1]; $tmdh = $attr[0][0]; echo "<div>题目名称:{$tmmc}</div>"; $sqlxx = "select * from diaoyanxuanxiang where timudaihao ='{$tmdh}'"; $attrxx = $db->Query($sqlxx); echo "<div id='list'>"; foreach($attrxx as $v) { echo "<div><input type='checkbox' value='{$v[0]}' name='xx[]' /> <span>{$v[1]}</span> </div>"; } ?> <input type="submit" value="提交"/> <input type="button" value="查看结果" id="check" onclick="Showjieguo()"/> </form> </div> <div id="jieguo" style="display:none"> <?php $sqlsum = "select sum(Numbers) from diaoyanxuanxiang where timudaihao = '{$tmdh}'"; $attrsum = $db->Query($sqlsum);//所有人数 foreach($attrxx as $v) { $name = $v[1];//选项名 $number = $v[2];//选择该项的人数 $bfb = ($number/$attrsum[0][0])*100; $bfb = round($bfb,2); echo "<div style='width:250px; height:30px'> <span class='x'>{$name}</span> <div class='x' style='width:100px; height:8px; border:1px solid red'> <div style='width:{$bfb}%; height:8px; background-color:red'></div> </div> <span class='x'>{$number} </span> <span class='x'>{$bfb}%</span> </div>"; } ?> <input type="button" value="返回" id="fanhui" onclick="Showlost()"/> </div> <script type="text/javascript"> function Showjieguo() { document.getElementById("list").style.display = "none"; document.getElementById("jieguo").style.display = "block"; } function Showlist() { document.getElementById("list").style.display = "block"; document.getElementById("jieguo").style.display = "none"; } </script> </body>
<?php $attr = $_POST["xx"]; include("../DBDA.class.php"); $db = new DBDA(); foreach($attr as $v) { $sql = "update diaoyanxuanxiang set Numbers = Numbers+1 where Ids = '{$v}'"; $db->Query($sql,1); } header("location:toupiao.php");
相关文章推荐
- 租房子
- supervisor安装配置与使用
- 【bzoj4554】[Tjoi2016&Heoi2016]游戏
- [备忘]MFC各种控件使用,线程
- struts1中配置应用
- 构建之法:第8、9、10章读后感
- Scrum 7.0
- python urllib2 实现HTTP 的GET POST 请求
- hdu 1176 免费馅饼
- Android中px dpi dip density densityDpi 的相关说明
- 项目管理
- DB2函数大全
- 项目管理
- PayPal高级工程总监:读完这100篇论文 就能成大数据高手
- 【leetcode】169. Majority Element
- Python基础学习笔记之(一)
- READING NOTE: Object Detection from Video Tubelets with Convolutional Neural Networks
- (按钮)上面为图片下部为文字的 按钮 控件
- BZOJ 2330 糖果
- Oracle 【to_number】【instr】