关于复选框的问题@! 请参考SMARTY的html_checkboxes部分,例子非常详细。链接 点击查看 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 具体的代码就不写了,实现的思路就是将从数据库中取出的相应的国家和复选框中的value值比较,如果相同就设置其属性为checked="checked"即可 or where PHP code is:<?php$smarty->assign('cust_checkboxes', array( 1000 => 'Joe Schmoe', 1001 => 'Jack Smith', 1002 => 'Jane Johnson', 1003 => 'Charlie Brown') );$smarty->assign('customer_id', 1001);?>and the template is{html_checkboxes name='id' options=$cust_checkboxes selected=$customer_id separator='<br />'}both examples will output:<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br /><label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br /><label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br /><label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br /> SICTXK 谢谢你 但是 你的这个只是输出。 。请问 如何和数据库的值做比较? $smarty->assign('customer_id', 1001);1001这个值就是在数据库中的取值。在进行assign之前是从数据库取值,设此值为$arr_check_customer,既可以为单个值1001也可以为数组。$smarty->assign('customer_id', $arr_check_customer);页面在输出时就可以将$arr_check_customer中的值显示为选中。 java的32位MD5加密与php中的32位MD5加密结果不一样。求帮助。急急急 php 能拿到 mac地址否 ?? 怎么判断一个字符是不是繁体中文? div问题,各位帮个忙 征求答案:一个SQL存储过程的写法 分页的问题 php 调用JAVASCRIPT并返回值 急急 哪有下载WDB论坛的 请教一下如何使页面不可脱机浏览 php 如何获得标题与标题之间的内容 , 整体内容为字符串,该如何获取 PHP读取xml数据 PHP+MYSQL 部分记录无法更新。求达人解惑。
<?php$smarty->assign('cust_checkboxes', array(
1000 => 'Joe Schmoe',
1001 => 'Jack Smith',
1002 => 'Jane Johnson',
1003 => 'Charlie Brown')
);
$smarty->assign('customer_id', 1001);?>and the template is{html_checkboxes name='id' options=$cust_checkboxes
selected=$customer_id separator='<br />'}both examples will output:<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label>
<br />
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
在进行assign之前是从数据库取值,设此值为$arr_check_customer,既可以为单个值1001也可以为数组。
$smarty->assign('customer_id', $arr_check_customer);
页面在输出时就可以将$arr_check_customer中的值显示为选中。