Home > Backend Development > PHP Tutorial > php怎么办复选的投票功能

php怎么办复选的投票功能

WBOY
Release: 2016-06-13 13:27:02
Original
1122 people have browsed it

php怎么处理复选的投票功能
小弟有个问题想请教大家
我现在有个复选框的表单





篮球

足球

排球




数据库是这样的:
id name tic(得票数)
1 篮球 0
2 足球 0
3 排球 0

我想实现的功能是表单提交后,选中的复选框对应的数据库里的tic得票数加1


------解决方案--------------------
PHP code
foreach($_POST['sport'] as $id){
         mysql_query("update tt set tic=tic+1 where id=$id");
} <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template