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 ...
随机推荐
- linux设备驱动程序_hello word 模块编译各种问题集锦
在看楼经典书籍<linux设备驱动程序>后,第一个程序就是编写一个hello word 模块. 原以为非常easy,真正弄起来,发现问题不少啊.前两天编过一次,因为没有记录,今天看的时候又 ...
- 浅谈API网关(API Gateway)如何承载API经济生态链
序言 API经济生态链已经在全球范围覆盖, 绝大多数企业都已经走在数字化转型的道路上,API成为企业连接业务的核心载体, 并产生巨大的盈利空间.快速增长的API规模以及调用量,使得企业IT在架构上.模 ...
- HDU 5325 Crazy Bobo(思路+dfs 记忆化)
Crazy Bobo Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Tota ...
- cookie知识点简点
cookie几大作用: 1.保持用户登陆状态 2.跟踪用户行为 3.制定页面 4.创建购物车 cookie缺点: 1. 可能被禁用 2.可能被删除:cookie是一个文件,easy被用户删除 3.安全 ...
- Selenium中配置链接使用FTP服务
Enable the default report solution Step1: Create a suite listener and add codes into it, please watc ...
- 洛谷 P3377 模板左偏树
题目:https://www.luogu.org/problemnew/show/P3377 左偏树的模板题: 加深了我对空 merge 的理解: 结构体的编号就是原序列的位置. 代码如下: #inc ...
- MySQL之自定义函数实例讲解
转自:https://www.2cto.com/database/201804/740205.html MySQL中已经有很多函数,如时间函数等,但是有时这些函数不能满足自己的设计需求,此时需要自定义 ...
- C# 单例3种写法
public class Singleton { private static Singleton _instance = null; private Singleton(){} public sta ...
- $CF1141A Game 23$
这题很简单啊 可以用\(DFS\)来打 毕竟是 \(2^x*3^y=m 输出x+y啊\) 这是最简单的做法 #include <bits/stdc++.h> using namespace ...
- python自动化测试学习笔记-5常用模块
上一次学习了os模块,sys模块,json模块,random模块,string模块,time模块,hashlib模块,今天继续学习以下的常用模块: 1.datetime模块 2.pymysql模块(3 ...