使用implode()函数将数组逗号隔开连接为字符串
checkbox提交过来一个数组,为了将数组中的值插入到SQL语句执行,需要将数组的键值使用逗号隔开:index.html
checkbox提交过来一个数组,为了将数组中的值插入到SQL语句执行,需要将数组的键值使用逗号隔开:
index.html
2.php
3个checkbox全都选择提交后,输出的结果为:1,2,3,可以直接插入到SQL语句执行。
<form action="2.php" method="post"> <input name="select[]" type="checkbox" value="1" />1 <input name="select[]" type="checkbox" value="2" />2 <input name="select[]" type="checkbox" value="3" />3 <input type="submit" value="submie" /> </form>
<?php
$array = $_POST["select"];
$select = implode(",", $array);
echo $select;
?>
特别声明:以上内容(如有图片或视频亦包括在内)为本平台用户上传并发布,本平台仅提供信息存储服务。举报




