<!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'>&nbsp;{$v[2]}&nbsp;</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 投票系统练习的更多相关文章

  1. Django快速开发之投票系统

    https://docs.djangoproject.com/en/1.8/intro/tutorial01/ 参考官网文档,创建投票系统. ================ Windows  7/1 ...

  2. 投票系统 & 简易js刷票脚本

    早就听说有什么刷票脚本,微博投票等等相关的投票都有某些人去刷票. 试一下吧,兴许自己也会刷票呢?捣鼓了几个小时,终于有所眉目. (1)投票系统 要刷票,就得先有个投票界面. 当然,可以直接去各个投票网 ...

  3. (转)投票系统,更改ip刷票

    前言 相信大家平时肯定会收到朋友发来的链接,打开一看,哦,需要投票.投完票后弹出一个页面(恭喜您,您已经投票成功),再次点击的时候发现,啊哈,您的IP(***.***.***.***)已经投过票了,不 ...

  4. JavaWeb项目开发案例精粹-第2章投票系统-006view层

    1.index.jsp <%@ page language="java" import="java.util.*" pageEncoding=" ...

  5. Django写的投票系统2(转)

    在上一篇中 django实例:创建你的第一个应用投票系统(一) 已经介绍基本的功能,并已经启动服务了.这一节介绍数据库相关的东东. 首页打开mysite/settings.py配置文件, 设置数据库打 ...

  6. Django写的投票系统1(转)

    当然主要是从django的帮助文档里面来的,权当是翻译吧 这个投票系统的主要功能有 1.一个前台页面,可以让用户来投票 2.一个管理员页面,可以用来添加.修改.删除投票 首页第一步要确定你已经安装了D ...

  7. 投票系统 & js脚本简单刷票

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. SSM框架整合项目 :投票系统

    框架: Spring SpringMVC MyBatis 题目: 投票系统 导包: 1, spring 2, MyBatis 3, mybatis-spring 4, fastjson 5, aspe ...

  9. C语言 投票系统:给定候选人,从键盘输入候选人的名字,统计票数,并输出最终获胜者

    投票系统:给定候选人名单,从键盘输入候选人的名字,统计票数,并输出最终获胜者.若投票人输入的名字不在其候选名单上,则该票数无效. //凯鲁嘎吉 - 博客园 http://www.cnblogs.com ...

  10. 如何实现基于ssh框架的投票系统的的质量属性

    如何实现基于ssh框架的投票系统的的质量属性: 项目 :网上考试系统 我做的是网上考试系统,因为标准化的考试越来越重要,而通过计算机进行标准化判卷,系统会自动判卷出成绩,组织考试的人不用组织人员打印试 ...

随机推荐

  1. HDU 5120 A Curious Matt(2014北京赛区现场赛A题 简单模拟)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112 解题报告:扫一遍 #include<cstdio> #include<cstr ...

  2. HNU 12885 Bad Signal(模拟)

    题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12885&courseid=274 解题报告:一共有n个 ...

  3. 进军swift

    swift中文文档网站 http://letsswift.com/category/swiftguide/language-guide/ Swift的优缺点 , 来自珍妮讲解~~ 优点1.简洁(不是说 ...

  4. [POJ1068]Parencodings

    [POJ1068]Parencodings 试题描述 Let S = s1 s2...s2n be a well-formed string of parentheses. S can be enco ...

  5. [转载]Web 研发模式演变

    原文链接:https://github.com/lifesinger/blog/issues/184 前不久徐飞写了一篇很好的文章:Web 应用的组件化开发.本文尝试从历史发展角度,说说各种研发模式的 ...

  6. union联合体

    今天笔试的一道题,好久没用union了,竟然忘光光了. 关于其大小的计算,分两步:先算对齐大小(成员中字节最大的那个),再算分配空间: 不仅是对齐大小的整数倍,还要满足实际大小不能小于最大成员大小. ...

  7. svn下目录说明

    Branch 目录 : 该SVN 的Branch目录下存放的是:跟工程项目相关的各个工程版本分支.该目录下面的版本分支可能会被修改合并.不是稳定的版本. Document 目录:该SVN 的Docum ...

  8. 解决ubuntu下安装mysql使用service无法启动问题

    启动的时候发现service mysql start Rather than invoking init scripts through /etc/init.d, use the service(8) ...

  9. 7.6--找过点最多的直线(CC150)

    直接两个点确定一条直线.然后两两组合,再写一个看过多少个点的函数.一直更新max就行. import java.util.Arrays; public class Solution { public ...

  10. PHP的Tag标签

    PHP的标签有至少四种:<?php ?>.<?= ?>.<script language="php"></script>.<? ...