smarty fecth模板怎么输出checkbox复选框
$str="";foreach($order_cardas$card){if($card['crc32']==0||$card['crc32']==crc32(AUTH_...
$str=" ";
foreach ($order_card as $card)
{
if ($card['crc32'] == 0 || $card['crc32'] == crc32(AUTH_KEY))
{
$card['card_sn'] = decrypt($card['card_sn']);
$card['card_password'] = decrypt($card['card_password']);
}
$str .="<input type='checkbox' name='checkbox' value='checkbox' />";
}
$smarty->assign('checkbox',$str);
$smarty->assign('card',$card);
$content = $smarty->fetch('check.tpl');
make_json_result($content);
check.tpl里这么写的:
{foreach from=$card item=c}
{$checkbox}{$c.card_sn} {$c.card_password}
{/foreach}
现在的情况是没有任何东西输出,我想要的效果是输出 复选框+card_sn+card_password 展开
foreach ($order_card as $card)
{
if ($card['crc32'] == 0 || $card['crc32'] == crc32(AUTH_KEY))
{
$card['card_sn'] = decrypt($card['card_sn']);
$card['card_password'] = decrypt($card['card_password']);
}
$str .="<input type='checkbox' name='checkbox' value='checkbox' />";
}
$smarty->assign('checkbox',$str);
$smarty->assign('card',$card);
$content = $smarty->fetch('check.tpl');
make_json_result($content);
check.tpl里这么写的:
{foreach from=$card item=c}
{$checkbox}{$c.card_sn} {$c.card_password}
{/foreach}
现在的情况是没有任何东西输出,我想要的效果是输出 复选框+card_sn+card_password 展开
1个回答
展开全部
您好,HTML可以这样写<input type="checkbox" value="中国" name="Country[]"> 所有的复选框都用 name="Country[]" 这样提交上去那边 PHP 收到的这个值 就直接是一个数组 $_POST['Country'] 这个取得的就是一个数组,当然表单要以POST方式提交。然后可以像另一位朋友说的那样来保存。取出来的时候再 explode(',',字段内容) 来折分成数组,就好处理了。
<input type="submit" value="提交">要加个name属性"submit"
if(isset($_POST['submit'])){
$checkval =$_POST['abc'];
$username = $_POST['user_name'];
echo $checkval.username;
}
<input type="submit" value="提交">要加个name属性"submit"
if(isset($_POST['submit'])){
$checkval =$_POST['abc'];
$username = $_POST['user_name'];
echo $checkval.username;
}
追问
check.tpl里那么写对吗?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询