|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
DeS3 Smarty n00b
Joined: 08 Jul 2021 Posts: 1
|
Posted: Thu Jul 08, 2021 8:06 pm Post subject: foreach in PHP dropdown. |
|
|
Hi everyone, I have a question how can I do a proper foreach of the following code:
Code: | foreach($options as $multiplier) {
$option = "<option ";
if ($multiplier == $results['multiplier'])
{
$option .= "selected=selected ";
}
$option .= "value=".$multiplier.">" . unesc($multiplier) . "</option>";
$multi['option'] = $option;
$multiplier_option[] = $multi;
}
$smarty->assign('multiplier_option', $multiplier_option);
unset($multiplier_option); |
HTML:
Code: | <tr>
<td align='left' class='header'>{$lang_multiplier}:</td>
<td align='left' class='lista' colspan='2'><select name='multiplier'>{foreach item=multi from=$multiplier_option}{$multi.option}{/foreach}</select></td>
</tr> |
I tried it this way but seems to not work properly.
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|