I am using a custom php frame work . i use smarty template engine . i start create a form within the controller file and i introduce a form element in .tpl file using html_checkbox . But this element cannot be found when i submit the form . how do i make the .tpl content part of the form .
1条回答 默认 最新
- dqnrk44682 2010-10-16 14:14关注
When you create checkboxes using smarty's
{html_checkboxes}
, the name attribute in the smarty function will be used to as the name for the checkboxes.For example, if your smarty call is:
{html_checkboxes name='states' options=$states}
The resulting checkboxes will have the name
states[]
which, when submitted, will be placed into a single PHP array which can be looped over to determine which states were selected:foreach ($_POST['states'] as $state) { }
Two things to keep in mind: it is up to you to wrap the checkboxes in form tags. Also if no boxes are checked, they will not be submitted in the form post data. This is a quirk of HTML and has nothing to do with smarty.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 VUE项目怎么运行,系统打不开
- ¥50 pointpillars等目标检测算法怎么融合注意力机制
- ¥15 关于超局变量获取查询的问题
- ¥20 Vs code Mac系统 PHP Debug调试环境配置
- ¥60 大一项目课,微信小程序
- ¥15 求视频摘要youtube和ovp数据集
- ¥15 在启动roslaunch时出现如下问题
- ¥15 汇编语言实现加减法计算器的功能
- ¥20 关于多单片机模块化的一些问题
- ¥30 seata使用出现报错,其他服务找不到seata