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框架的投票系统的的质量属性: 项目 :网上考试系统 我做的是网上考试系统,因为标准化的考试越来越重要,而通过计算机进行标准化判卷,系统会自动判卷出成绩,组织考试的人不用组织人员打印试 ...
随机推荐
- django xadmin 插件(3) 列表视图新增自定义按钮
效果图: 编辑按钮是默认的list_editable属性对应的插件(xadmin.plugins.editable) 放大按钮对应的是自定义插件. 自定义按钮源码: xplugin.py(保证能够直接 ...
- Mybatis 3.3.0 Log4j配置
最近做一个SSM学习项目,配置log4j,mybatis用下面的方式配置,不管用,打印不出执行的SQL语句. log4j.logger.java.sql.Connection=DEBUGlog4j.l ...
- phpcms模板标签整理
{template "content","header"} 调用根目录下phpcms\template\content\header文件 {CHARSET} 字 ...
- 【GoLang】golang runtime 调度原理
参考资料: http://m.yl1001.com/group_article/3231471449287668.htm http://tieba.baidu.com/p/3542454435?sha ...
- SQL查询表中的有那些索引
方法1. 使用系统表 -- 查询一个表中的索引及索引列 USE AdventureWorks2008 GO SELECT indexname = a.name , tablename = c. n ...
- hashCode与equals的区别与联系
一.equals方法的作用 1.默认情况(没有覆盖equals方法)下equals方法都是调用Object类的equals方法,而Object的equals方法主要用于判断对象的内存地址引用是不是同一 ...
- POJ 2479
---恢复内容开始--- http://poj.org/problem?id=2479 #include <stdio.h> #include <iostream> using ...
- MySQL SQL优化之in与range查询【转】
本文来自:http://myrock.github.io/ 首先我们来说下in()这种方式的查询.在<高性能MySQL>里面提及用in这种方式可以有效的替代一定的range查询,提升查询效 ...
- 细看INNODB数据落盘
本文来自:沃趣科技 http://www.woqutech.com/?p=1459 1. 概述 前面很多大侠都分享过MySQL的InnoDB存储引擎将数据刷新的各种情况.我们这篇文章从InnoDB往 ...
- SAP 透明表之间的关联字段
VTTK-TPLST=TTDST-TPLST(装运点的关联表及描述表字段TTDST-BEZEI) VTTK-ROUTE=TVROT-ROUTE(装运线路关联表及描述表字段TVROT-BEZEI) VT ...