Home> php教程> php手册> body text

用PHP处理多个同名复选框

WBOY
Release: 2016-06-21 09:10:31
Original
769 people have browsed it

复选框

如果一个表单中有多个同名复选框,在提交到php时却只有一个值,而并不像asp那样是一串用逗号分割的值。有一个很简单的方法来解决:将复选框的name后面加上[],例如:改为:。这样php将得到一个叫ccc的阵列。但这种方法有个问题,如果您要在客户端对复选框是否被选择、选择了几个用javascript来判断时,javascript会因为复选框的name中含有[]而出错。您可以在表单中加入一个隐含域,用javascript设置它的值。



...








...



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