dcjones Posted December 7, 2007 Share Posted December 7, 2007 Hi all I have a script which produces random codes used for coupons. The script that generates the random code is: function generate_coupons(){ global $db, $t, $vars; $vars['discount'] = trim("$vars[discount_v] $vars[discount_t]"); set_date_from_smarty('begin_date', $vars); set_date_from_smarty('expire_date', $vars); $batch_id = $db->generate_coupons($vars); $coupons = $db->get_coupons('batch_id', $batch_id); $t->assign('coupons', $coupons); $t->display('coupon_generated_tier.php'); } On my SMARTY template script I have: input type="text" readonly="readonly" class="agentformbl" name="couponid" value="{foreach from=$coupons item=c} {$c.code} {/foreach}" size="32" /> What I am trying to do is assign the content of "{foreach from=$coupons item=c}{$c.code}{/foreach} to a $_SESSION variable. Hers a very bad example: $_SESSION['c'] = {foreach from=$coupons item=c}{$c.code}{/foreach} I know that thos example is not the way it is done, but I just don't know how. Can anyone please help. Best regards dereck Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.