PHP复选框验证 [英] PHP Checkbox Validation
问题描述
我想使用复选框或其他客户端代码ID来验证带有复选框的PHP表单:
I want to validate a PHP form with checkboxes preferably using Javascript or otherwise the client side code 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(如果未选中)。我该怎么办?
and so on.. Basically on the server side I enter a Y in the database if the box is checked and a N if its unchecked. How exactly can I go about this?
推荐答案
不要害怕,不要弄脏你的手!制作一个带有少量复选框和POST方法的HTML表单的简单示例,然后制作一个简单的PHP代码,该代码转储$ _POST的内容(例如:
Don't be afraid and get your hands dirty! Make a simple example of HTML form with few checkboxes and the POST method, and then make simple PHP code which dumps the content of $_POST (e.g. like:
echo "<pre>";
var_dump($_POST);
echo "</pre>";
然后看看会发生什么...然后只需对其进行处理就可以了!
And see what is coming there... Then just process it and that's it!
这篇关于PHP复选框验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!