Home  >  Article  >  Backend Development  >  Simple PHP to get the value code of the check box_PHP tutorial

Simple PHP to get the value code of the check box_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:44:51940browse

In PHP, we generally use the array form to do the checkbox checkbox. In this way, when we get the checkbox value in PHP, we will store it in the array form, so we only need to traverse the array to achieve it.




The code is as follows
 代码如下 复制代码



获取复选框的值



1
2
3




Copy code

 代码如下 复制代码

foreach($_POST['year'] as $item){
echo $item."
";
}
?>



Get the value of the check box



1   
2   
3

The code is as follows Copy code
foreach($_POST['year'] as $item){
echo $item."
";
}
?>
http://www.bkjia.com/PHPjc/633081.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633081.htmlTechArticleIn php, we generally use the array form to get the checkbox checkbox. We will store the selection box value in the form of an array, so we only need to traverse the array to achieve...
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