Home > Backend Development > PHP Tutorial > 急PHP中如何样判断checkbox是否被选中

急PHP中如何样判断checkbox是否被选中

WBOY
Release: 2016-06-13 10:03:56
Original
1162 people have browsed it

急!!PHP中怎么样判断checkbox是否被选中?
PHP中checkbox怎么样判断是否被选中?

------解决方案--------------------
取得的值不为空即为选中






------解决方案--------------------
check.html:


 


checkbox.php:

if($_POST)
{if($_POST['select']!=""){echo "不为空";}else{echo "为空";}}
?>
------解决方案--------------------
可以用JS先判断,如
if(form.checkname.checked) {}
如果多个,可以使用JS循环,把check的值组成字符串提交,或使用4楼的方法.
提交到php页再判断一次.:-)
------解决方案--------------------
PHP 没有办法判断。只能当表单提交后,进行取值再判断。 
可以通过客户端JS 来做判断。 
检测他 checked 是否为true
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