dongyu1918 2012-01-21 16:01
浏览 27
已采纳

HTML格式的许多字段

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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥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上的问题