php第十四节课
投票
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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.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="ShowList()" />
</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>
</html>
<?php
$attr = $_POST["xx"];
include("../DBDA.php");
$db = new DBDA();
foreach($attr as $v)
{
$sql = "update DiaoYanXuanXiang set Numbers = Numbers+1 where Ids = '{$v}'";
$db->Query($sql,0);
}
header("location:test.php");
php第十四节课的更多相关文章
- centos Linux系统日常管理1 cpuinfo cpu核数 命令 w, vmstat, uptime ,top ,kill ,ps ,free,netstat ,sar, ulimit ,lsof ,pidof 第十四节课
centos Linux系统日常管理1 cpuinfo cpu核数 命令 w, vmstat, uptime ,top ,kill ,ps ,free,netstat ,sar, ulimit ...
- 风炫安全web安全学习第三十四节课 文件包含漏洞防御
风炫安全web安全学习第三十四节课 文件包含漏洞防御 文件包含防御 在功能设计上不要把文件包含的对应文件放到前台去操作 过滤各种../,https://, http:// 配置php.ini文件 al ...
- 风炫安全WEB安全学习第二十四节课 利用XSS钓鱼攻击
风炫安全WEB安全学习第二十四节课 利用XSS钓鱼攻击 XSS钓鱼攻击 HTTP Basic Authentication认证 大家在登录网站的时候,大部分时候是通过一个表单提交登录信息. 但是有时候 ...
- 《linux就该这么学》第十四节课:第13章,部署DNS域名解析服务(bind服务)
(借鉴请改动) 第十二章收尾 12.2.nfs网络文件系统 RHEL7默认安装了nfs,配置文件在 /etc/export 写入格式:共享目录 允许的客户端(参数) ro ...
- C#第十四节课
函数的调用 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System ...
- php第二十四节课
三级联动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...
- centos shell编程5 LANMP一键安装脚本 lamp sed lnmp 变量和字符串比较不能用-eq cat > /usr/local/apache2/htdocs/index.php <<EOF重定向 shell的变量和函数命名不能有横杠 平台可以用arch命令,获取是i686还是x86_64 curl 下载 第三十九节课
centos shell编程5 LANMP一键安装脚本 lamp sed lnmp 变量和字符串比较不能用-eq cat > /usr/local/apache2/htdocs/ind ...
- centos LAMP第一部分-环境搭建 Linux软件删除方式,mysql安装,apache,PHP,apache和php结合,phpinfo页面,ldd命令 第十九节课
centos LAMP第一部分-环境搭建 Linux软件删除方式,mysql安装,apache,PHP,apache和php结合,phpinfo页面,ldd命令 第十九节课 打命令之后可以输入: e ...
- centos linux系统日常管理3 服务管理ntsysv,chkconfig,系统日志rsyslog,last ,lastb ,exec,xargs,dmesg,screen,nohup,curl,ping ,telnet,traceroute ,dig ,nc,nmap,host,nethogs 第十六节课
centos linux系统日常管理3 服务管理ntsysv,chkconfig,系统日志rsyslog,last ,lastb ,exec,xargs,dmesg,screen,nohup,cur ...
随机推荐
- DCS实践干货:使用Redis实现分布式锁
场景介绍 很多互联网场景(如商品秒杀,论坛回帖盖楼等),需要用加锁的方式,以对某种资源进行顺序访问控制.如果应用服务集群部署,则涉及到对分布式应用加锁.当前分布式加锁主要有三种方式:(磁盘)数据库.缓 ...
- 【cocos2dx 小技巧】半透明屏蔽罩和弹出框的实现
今天介绍一下,弹出框的和屏蔽罩的小实现~ 弹出框主要用到了cocos2dx生命周期里面的OnEnter()函数,就是当Layer被addChild的时候会调用的函数(所以假设把OnEnter的代码加到 ...
- 数据库定时删除历史数据的SQL指令
新建作业,用于定时清除数据库的历史数据 删除表gps_comm 之前120天即一个季度的数据,例如以下: ELETE FROM gps_comm WHERE (时间 < GETDATE() - ...
- Linux 学习之路:认识shell和bash
一.shell 计算机硬件的直接控制者是操作系统的内核(kernel),因为内核的重要性,所以作为用户的我们是无法直接操作内核的,所以我们需要shell调用应用程序或者双击打开安装的应用软件与内核之 ...
- (函数即服务)Faas的现状与未来
刚看到jolestar一位从法律转行程序员的前辈写了一篇Faas现状与未来的文章,里面很多观点都很有启发,或许正如他说的那样,由于Faas能较好的解决资源利用率和开发效率问题,2018年Faas将变得 ...
- Weblogic 启动慢解决方法
添加 启动参数 : -Xms256m -Xmx512m -XX:MaxPermSize=256m 原因 : 实际是JVM在Linux下的bug:他想调用一个随机函数,但是取不到. 暂时 ...
- ognl表达式注意事项
1.在jsp页面中: <s:a action="departmentAction_delete.action?did="></s:a> 说明: 1.st ...
- js判断出两个字符串最大子串的函数
<!DOCTYPE html><html><head> <title></title></head><script typ ...
- Gym - 100920E 2010-2011 OpenCup IX Onsite, II Yandex Summer School E.Paint 状压DP
题面 题意:给你n(20)个点,m(40条边),让你给每条边染一种颜色,白色0元,红色2元,蓝色1元,现在要保证每一条白边相邻的有一条红边,问至少花多少 题解:刚开始想的时候,好像觉得只用染红色和白色 ...
- ubuntu16.04更改源
最近用apt-get安装软件总是提示列表无法全部更新,导致一些软件安装不上,下面我们通过讲/etc/apt/sources.list里为阿里源,实现访问. 第一步: 备份/etc/apt/source ...