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

php怎么办复选的投票功能

WBOY
WBOYOriginal
2016-06-13 13:27:021051browse

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>
Statement:
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