Home > Backend Development > PHP Tutorial > 关于PHP从checkbox取值

关于PHP从checkbox取值

WBOY
Release: 2016-06-23 14:28:55
Original
833 people have browsed it

在用到checkbox的时候发现php只能取一个值,查了相关资料,原因如下:

Php代码 

           


weeks后的中括号不可漏,否则用PHP获取的时候只能取到最后一个值。之后PHP就很好处理了,如下:

Php代码 

方法一:   $weeks = $_POST['weeks'];   for($i=0;$i";       方法二:   $array = $this->request->getParameter("weeks[]");   $str =implode(',',$array);   echo $str;  

 

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