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框架的投票系统的的质量属性: 项目 :网上考试系统 我做的是网上考试系统,因为标准化的考试越来越重要,而通过计算机进行标准化判卷,系统会自动判卷出成绩,组织考试的人不用组织人员打印试 ...
随机推荐
- img标签src=""和background-image:url();引发两次请求页面bug
img标签src=""和background-image:url();引发两次请求页面bug 具体原因是,在img 对象的src 属性是空字符串("")的时 ...
- 导航栏的坑 (导航透明/导航除线/titleIView)
//以下四个条件缺一不可 /.必须是半透明状态 self.navigationBar.translucent = YES; //2.导航栏背景图片为空图片 (不可以设置backgroundColor或 ...
- OpenCV中对图像进行二值化的关键函数——cvThreshold()。
函数功能:采用Canny方法对图像进行边缘检测 函数原型: void cvThreshold( const CvArr* src, CvArr* dst, double threshold, doub ...
- java的字体的颜色,型号,大小的方法
jTextPane1.setForeground(Color.green);//设置java字体的颜色 设置字体的颜色和型号和大小 jTextPane1.setFont(new Font(&quo ...
- Maven打包附加配置文件
在build节点下增加resources. <build> <!-- 资源 --> <resources> <!-- 复制非class文件 --> &l ...
- curl api create domain
from: https://adam.younglogic.com/2013/09/keystone-v3-api-examples/ http://docs.openstack.org/develo ...
- IPC----消息队列
消息队列可以认为是一个消息链表,System V 消息队列使用消息队列标识符标识.具有足够特权的任何进程都可以往一个队列放置一个消息,具有足够特权的任何进程都可以从一个给定队列读出一个消息.在某个进程 ...
- STL---list(列表)
Lists将元素按顺序储存在链表中. 与 向量(vectors)相比, 它允许快速的插入和删除,但是随机访问却比较慢. list的类模板声明为 template<class T, class A ...
- sqlite ORMLite 框架应用
bean package com.test.deamo.bean; import android.os.Parcel; import android.os.Parcelable; import com ...
- Linux下安装Scala
Linux下安装Scala和Windows下安装类似,步骤如下: 首先访问下载链接:http://www.scala-lang.org/download/默认这里下载的是Windows版本,这时点击上 ...