表itemtable是通过以下mysql语句建立的:
create table `itemtable` (
`id` tinyint( 4 ) not null auto_increment,
`name` varchar( 50 ) not null ,
`votes` smallint( 6 ) not null ,
primary key ( `id` )
);
其中字段“name”是列表项目名,“votes”是所得票数。我们还要建立一个表“voteiptable”来记录投票用户的ip:
create table `voteiptable` (
`id` smallint( 6 ) not null ,
`voteip` varchar( 15 ) not null,
primary key ( `id` )
);
下面我们编写文件“multivote.php”,今天我们要用到一个数据库类文件“dbclass.php”.
我们可以发现,客户端的javascript和服务器端的php对多项选择的处理有很多相似之处,当然也有不同。这是比较经典的多选项处理的程序,如果不限定用户的选项的话就更简单了。
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!


