首页 > 代码库 > PHP获取复选框的值
PHP获取复选框的值
HTML代码:
<p class="dc_input"><input class="radio" type="checkbox" name="check[]" value="http://www.mamicode.com/1"/>复选框1</p>
<p class="dc_input"><input class="radio" type="checkbox" name="check[]" value="http://www.mamicode.com/2"/>复选框2</p>
<p class="dc_input"><input class="radio" type="checkbox" name="check[]" value="http://www.mamicode.com/3"/>复选框3</p>
<p class="dc_input"><input class="radio" type="checkbox" name="check[]" value="http://www.mamicode.com/4"/>复选框4</p>
<p class="dc_input"><input class="radio" type="checkbox" name="check[]" value="http://www.mamicode.com/5"/>复选框5</p>
PHP代码:
$check = $_POST[‘check‘];获取到的是个数组
$check=implode(",", $check);//implode函数将数组分割成字符串
PHP获取复选框的值