I have a form with about 150 fields, however the user can add more fields, reaching about 300 fields. I'd like to know if exist a good way to put names and IDs to my fields, or i have to give each one a diferent name and ID. It's a hard job.
2条回答 默认 最新
- dongyuelian9602 2012-01-21 16:16关注
html with only one name for input
<form action="checkbox.php"> <input type="checkbox" name="data[]" value="1">1<br> <input type="checkbox" name="data[]" value="2">2<br> <input type="checkbox" name="data[]" value="3">3<br> <input type="checkbox" name="data[]" value="4">4<br> <input type="checkbox" name="data[]" value="5">5<br> <input type="submit"> </form>
checkbox.php
$data = $_GET["data"]; //$data is an array with checked option
it works also for type text
<input type="text" name="text_data[1]"><br> <input type="text" name="text_data[2]"><br> <input type="text" name="text_data[3]"><br>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
- ¥20 cad图纸,chx-3六轴码垛机器人
- ¥15 移动摄像头专网需要解vlan
- ¥20 access多表提取相同字段数据并合并
- ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
- ¥20 Java-Oj-桌布的计算
- ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
- ¥20 有人知道这种图怎么画吗?
- ¥15 pyqt6如何引用qrc文件加载里面的的资源
- ¥15 安卓JNI项目使用lua上的问题