Answer the question
In order to leave comments, you need to log in
How to make a loop in smarty?
Hello. I'm trying to make an online store, and for authorization, registration and personal account, the select tag in the form is used.
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 highheader2">
{foreach $rsAuth as $item name=auth}
<form action="{$item['route']}" method="post">
<select name="auth">
{$smarty.foreach.auth.iteration}
<option value="{$item['name']}">{$item['name']}</option>
</select>
</form>
{/foreach}
</div>
Answer the question
In order to leave comments, you need to log in
Try this (not tested)
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 highheader2">
<form action="{$rsAuth[0].route}" name="formAuth">
<select name="auth">
{foreach $rsAuth as $item name=auth}
<option value="{$item.name}" onchange="document.forms['formAuth'].action='{$item.route}'">{$item.name}</option>
{/foreach}
</select>
</form>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question