Home  >  Article  >  Backend Development  >  A simple way to get the checkbox value in php_php tips

A simple way to get the checkbox value in php_php tips

WBOY
WBOYOriginal
2016-05-16 19:52:271283browse

The example in this article describes how to simply obtain the check box value in PHP. Share it with everyone for your reference, the details are as follows:

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:

<&#63;php
$text1=$_POST['checkbox'];
for($i=0;$i<count($text1);$i++)
{
$yourwant = $text1[$i]; 
echo $yourwant."<br/>";
}
&#63;>

Readers who are interested in more PHP-related content can check out the special topics on this site: "Summary of PHP socket usage", "Summary of PHP network programming skills", " Summary of php curl usage", "Comprehensive collection of PHP array (Array) operation skills", "PHP data structure and algorithm tutorial", "Summary of PHP mathematical operation skills ", "php date and time usage summary", "php object-oriented programming introductory tutorial", "php string (string) usage summary》, "php mysql database operation introductory tutorial" and "php common database operation skills summary"

I hope this article will be helpful to everyone in PHP programming.

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