我想验证带有复选框的 PHP 表单,最好使用 Javascript 或客户端代码 ID:
Branch Features:</br>
Micro Centre:<input type='checkbox' value='micro' name='features[]'>High Value Branch:<input type='checkbox' value='highval' name='features[]'>
CBS Enabled:<input type='checkbox' value='cbs' name='features[]'>
Trade Finance Branch:<input type='checkbox' value='tradef' name='features[]'>
Personnel Banking Branch:<input type='checkbox' value='personnel' name='features[]'>
High Security Branch:<input type='checkbox' value='hsbranch' name='features[]'>
等等.. 基本上在服务器端,如果选中该框,我在数据库中输入 Y,如果未选中,则在数据库中输入 N。我到底该怎么做?
最佳答案
不要害怕,不要 Handlebars 弄脏!制作一个简单的 HTML 表单示例,其中包含几个复选框和 POST 方法,然后制作简单的 PHP 代码来转储 $_POST 的内容(例如:
echo "<pre>";
var_dump($_POST);
echo "</pre>";
看看那里会发生什么...然后处理它就这样了!
关于PHP 复选框验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6795132/