分享

Form表单传递数组

 苦修茶馆 2016-02-13

对于一个问题的多个答案,如果我们可以通过form表单传递数组,那程序处理起来会简单多了:

  1. <table><br>  
  2.     <tr><br>  
  3.         <td><input type="checkbox" name="how_hear[]" id="how_hear1" value="Website" ></td><br>  
  4.         <td style="padding-left:3px"><label for="how_hear1">Website</label></td><br>  
  5.     </tr><br>  
  6.     <tr><br>  
  7.         <td><input type="checkbox" name="how_hear[]" id="how_hear2" value="TV Commercial" /></td><br>  
  8.         <td style="padding-left:3px"><label for="how_hear2">TV Commercial</label></td><br>  
  9.     </tr><br>  
  10.     <tr><br>  
  11.         <td><input type="checkbox" name="how_hear[]" id="how_hear3" value="Magazine Ad" /></td><br>  
  12.         <td style="padding-left:3px"><label for="how_hear3">Magazine Ad</label></td><br>  
  13.     </tr><br>  
  14. </table><br>  
  15. "[]"表示这个变量是一个数组,如果是PHP的话,可以这样获得这个数组$_POST['how_hear']。  

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约