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框架的投票系统的的质量属性: 项目 :网上考试系统 我做的是网上考试系统,因为标准化的考试越来越重要,而通过计算机进行标准化判卷,系统会自动判卷出成绩,组织考试的人不用组织人员打印试 ...
随机推荐
- Homework
#include<stdio.h> #include<math.h> int main() { int a,b,c,l,p,s; printf("请输入三个数:&qu ...
- BestCoder Round #86 解题报告
A.Price List Sol 求和查询 Code #include<cstdio> #include<algorithm> #include<iostream> ...
- jQuery插件-表单验证插件-Validation
1.Validation简介 标准的验证方法库 1)内置验证规则:必填,数字,E-Mail,URL和信用卡号码等19类内置验证规则. 2)自定义验证规则:自定义 3)验证信息提示:默认了验证信息提示, ...
- ndk学习12: 线程
- Border Tree笔记
最近在学这个东西(当然不是行道树了QAQ..),感觉挺鬼畜的,整个人都不太好了..(特别是鬼畜的sone爷代码与讲稿),感觉他写的并不是普及向算法...?
- idea 排除编译文件,恢复编译
- 怎么安装MYSQL5.0的JDBC驱动
1.下载mysql for jdbc driver. http://dev.mysql.com/downloads/connector/j/3.1.htmlMySQL Connector/J is ...
- Android SDK 在线更新镜像服务器
大连东软信息学院镜像服务器地址:- http://mirrors.neusoft.edu.cn 端口:80 北京化工大学镜像服务器地址:- IPv4: http://ubuntu.buct.edu.c ...
- Oracle语句优化之一
public List<TdDepartment> createZtreeDep(String compId) { List<TdDepartment> dd = new Ar ...
- 【leetcode】N-Queens
N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no tw ...