Home  >  Article  >  Backend Development  >  PHP method to obtain check box value and simple example

PHP method to obtain check box value and simple example

墨辰丷
墨辰丷Original
2018-06-02 11:58:211865browse

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[&#39;checkbox&#39;];
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 Detailed explanation of method examples for WeChat public platform configuration interface development program

PHP recursion Traverse the folder, remove comments and compress phpSource code

Detailed explanation of the method of PHP implementation of the previous article and the next article

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!

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