Home > php教程 > php手册 > php checkbox 取值详细说明

php checkbox 取值详细说明

WBOY
Release: 2016-06-13 12:14:19
Original
1164 people have browsed it

设我们有一个html页面,代码如下:

复制代码 代码如下:











注意上面input的name属性,各个属性内容都一样,而且都是test[],加上[]的原因在于让test的内容变成数组形式传递。
checkTest.php的代码内容如下:

复制代码 代码如下:


echo implode(",",$_POST['test']);
?>


我们输出内容时只需要注意利用implode函数将数组内容转化为字符串即可。
注:该功能可在删除多记录等场合运用。如Delete from tbl where ID in (implode(",",$_POST['test']))即可。
实例代码:

复制代码 代码如下:





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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template