This article mainly introduces the method of PHP to simply obtain the checkbox value, and briefly analyzes the implementation method of PHP passing the checkbox value in the form of an array. Friends in need can refer to the following
html:
<form id="form1" name="form1" method="post" action="checkbox.php"> <input type=checkbox name=checkbox[] value="1"> <input type=checkbox name=checkbox[] value="2"> <input type=checkbox name=checkbox[] value="3"> <input type=checkbox name=checkbox[] value="4"> <input type=checkbox name=checkbox[] value="5"> <input type="submit" name="button" id="checkbox" value="提交" /> </form>
php:
<?php $text1=$_POST['checkbox']; for($i=0;$i<count($text1);$i++) { $yourwant = $text1[$i]; echo $yourwant."<br/>"; } ?>
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
PHP recursion Traverse the folder, remove comments and compress phpSource code
The above is the detailed content of PHP method to obtain check box value and simple example. For more information, please follow other related articles on the PHP Chinese website!