首页 > Web开发 > 详细

php处理复选框

时间:2019-08-30 15:08:37      阅读:75      评论:0      收藏:0      [点我收藏+]

1.HTML

<form action="getData.php" method="post" enctype="multipart/form-data">
<!--    php handles with radio
     the name attributes has the same name which is submmitted to $_POST
     only one vaule is submitted
    -->
    <input type="radio" name="gender" value="male">male
    <input type="radio" name="gender" value="female">female

<!--    php handles with radio-->
<!--    the name attributes has the same name array which are submmitted to $_POST-->
<!--    muti vaules are submitted-->
    <input type="checkbox" name="hobby[]" value="pingpong"> pingpong
    <input type="checkbox" name="hobby[]" value="vollyball"> vollyball
    <input type="checkbox" name="hobby[]" value="basketball"> basketball


</form>

 

echo ‘<pre>‘;
var_dump($_FILES);
var_dump($_POST);
$hobbyString = implode($_POST[hobby], "!");
// change hobby array into a string to store in mysql, retrieve it via explpde

 

php处理复选框

原文:https://www.cnblogs.com/luoxuw/p/11434590.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!