利用PHP怎么获取多个checkbox值
利用PHP怎么获取多个checkbox值?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
HTML页面:
<html> <head> </head> <body> <form name="myform" enctype="multipart/form-data" action="index2.php" method="post"> 兴趣爱好:<input type="checkbox" name="hobby[]" value="阅读"/>阅读 <input type="checkbox" name="hobby[]" value="篮球"/>篮球 <input type="checkbox" name="hobby[]" value="旅游"/>旅游 <br> 文件上传:<input name="myfile" type="file"> <input type="submit" value="提交" /> </form> </body> </html>
PHP页面:
$result = ""; foreach( $_POST['hobby'] as $i) { echo '<br>'; $result .= $i; } echo $result;
关于利用PHP怎么获取多个checkbox值问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注行业资讯频道了解更多相关知识。