php读取checkbox值几种方法
Jun 13, 2016 am 10:03 AM
phpbyvalueseveral kindsTutorialarraymethodObtainreadOptions
php教程获取checkbox多选项值时必须以数组形式了,下如test[]再用php post获取就ko了,下面看代码。
注意上面input的name属性,各个属性内容都一样,而且都是test[],加上[]的原因在于让test的内容变成数组形式传递。
checktest.php的代码内容如下:
$str =implode(',',$_post['test']);
print_r($str);
12345
哦。下面看我一朋友写的。
php代码
weeks后的中括号不可漏,否则用php获取的时候只能取到最后一个值。之后php就很好处理了,如下:
php代码
方法一:
$weeks = $_post['weeks'];
for($i=0;$iecho $weeks[1]."
";
方法二:
$array = $this->request->getparameter("weeks[]");
$str =implode(',',$array);
echo $str;
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
How to fix KB5055612 fails to install in Windows 10?
4 weeks agoByDDD
Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Roblox: Grow A Garden - Complete Mutation Guide
3 weeks agoByDDD
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools
