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">
.x
{
float:left;
}
#top
{
width:500px;
height:150px;
}
#bottom
{
width:500px;
height:150px;
display:none;
}
#fanhui
{
display:none;}
</style>
</head> <body>
<!--投票页面-->
<form action="toupiaochuli.php" method="post">
<?php
include("dbda.class.php");
$db=new dbda();
$stm="select * from diaoyantimu limit 0,1";
$atm=$db->Query($stm); echo "<div>题目名称:{$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>";
?> <!--显示结果-->
<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="提交" />
<input type="button" value="查看" onclick="showresult()" />
</div>
<div id="fanhui"><input type="button" value="返回" onclick="show()" /></div>
</form> </body>
<script type="text/javascript">
function showresult()
{
document.getElementById("top").style.display="none";
document.getElementById("bottom").style.display="block";
document.getElementById("fanhui").style.display="block";
document.getElementById("anniu").style.display="none";
}
function show()
{
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>
</html>
<?php
$ids=$_POST["xx"];
include("dbda.class.php");
$db=new dbda(); foreach($ids as $v)
{
$sql="update diaoyanxuanxiang set numbers=numbers+1 where
ids='{$v}'";
$db->Query($sql,0);
} header("location:lianxi.php");
php 投票系统练习的更多相关文章
- Django快速开发之投票系统
https://docs.djangoproject.com/en/1.8/intro/tutorial01/ 参考官网文档,创建投票系统. ================ Windows 7/1 ...
- 投票系统 & 简易js刷票脚本
早就听说有什么刷票脚本,微博投票等等相关的投票都有某些人去刷票. 试一下吧,兴许自己也会刷票呢?捣鼓了几个小时,终于有所眉目. (1)投票系统 要刷票,就得先有个投票界面. 当然,可以直接去各个投票网 ...
- (转)投票系统,更改ip刷票
前言 相信大家平时肯定会收到朋友发来的链接,打开一看,哦,需要投票.投完票后弹出一个页面(恭喜您,您已经投票成功),再次点击的时候发现,啊哈,您的IP(***.***.***.***)已经投过票了,不 ...
- JavaWeb项目开发案例精粹-第2章投票系统-006view层
1.index.jsp <%@ page language="java" import="java.util.*" pageEncoding=" ...
- Django写的投票系统2(转)
在上一篇中 django实例:创建你的第一个应用投票系统(一) 已经介绍基本的功能,并已经启动服务了.这一节介绍数据库相关的东东. 首页打开mysite/settings.py配置文件, 设置数据库打 ...
- Django写的投票系统1(转)
当然主要是从django的帮助文档里面来的,权当是翻译吧 这个投票系统的主要功能有 1.一个前台页面,可以让用户来投票 2.一个管理员页面,可以用来添加.修改.删除投票 首页第一步要确定你已经安装了D ...
- 投票系统 & js脚本简单刷票
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- SSM框架整合项目 :投票系统
框架: Spring SpringMVC MyBatis 题目: 投票系统 导包: 1, spring 2, MyBatis 3, mybatis-spring 4, fastjson 5, aspe ...
- C语言 投票系统:给定候选人,从键盘输入候选人的名字,统计票数,并输出最终获胜者
投票系统:给定候选人名单,从键盘输入候选人的名字,统计票数,并输出最终获胜者.若投票人输入的名字不在其候选名单上,则该票数无效. //凯鲁嘎吉 - 博客园 http://www.cnblogs.com ...
- 如何实现基于ssh框架的投票系统的的质量属性
如何实现基于ssh框架的投票系统的的质量属性: 项目 :网上考试系统 我做的是网上考试系统,因为标准化的考试越来越重要,而通过计算机进行标准化判卷,系统会自动判卷出成绩,组织考试的人不用组织人员打印试 ...
随机推荐
- 如何建立一个完整的游戏AI
http://blog.friskit.me/2012/04/how-to-build-a-perfect-game-ai/ 人工智能(Artificial Intelligence)在游戏中使用已经 ...
- 如何学习caffe
知乎上的讨论:https://www.zhihu.com/question/27982282 从0开始山寨caffe系列:http://www.cnblogs.com/neopenx/archive/ ...
- linux下安装使用libuuid(uuid-generate)
linux下安装使用libuuid(uuid-generate) linux下安装使用libuuid(uuid-generate) UUID简介 安装libuuid库 编写一个程序试一下 代码 编译运 ...
- IOS路线图
存档,存档...
- 二分图------》Hopcroft-Karp算法 hdu2389
Hopcroft-Karp算法 该算法由John.E.Hopcroft和Richard M.Karp于1973提出,故称Hopcroft-Karp算法. 原理 为了降低时间复杂度,可以在增广匹配集合M ...
- 初识Flask
首先在学习flask的前提,我是使用了很久的django和tornado,现在在写总结也是本着工作后方便使用flask 少点东西,对flask的介绍和优点总结 1.安装 pip install fla ...
- gjd
#include <cstdio> #include <cstring> #include <malloc.h> #define radix (1u<< ...
- OLA音频变速算法的仿真与剖析
前段时间,在尝试音乐节拍数的提取时,终于有了突破性的进展,效果基本上比市面上的许多商业软件还要好,在作节拍数检测时,高频信息作用不大, 通过重采样减小运算量.重采样让我想起了在学校里面做的变速变调算法 ...
- JS添加删除DIV
function addDiv(w,h){ //如果原来有“divCell”这个图层,先删除这个图层 deleteDiv(); //创建一个div var my = d ...
- FileUpload1上传控件
<asp:FileUpload ID="FileUpload1" runat="server" /> string fn = System.IO.P ...