This is the data I passed from the background to the template
<code><form action="{:U('Admin/Change/changegroup')}" method="post" accept-charset="utf-8"> <foreach name="data" item="v"> <tr> <td align="center"> <font>{++$i}</font> </td> <td align="center"> <font>{$v.admin_name}</font> </td> <td width="25%"> <select name="#" id="#" style="width: 300px;" class="span2"> <option value="1">第一组</option> <option value="2">第二组</option> <option value="3">第三组</option> <option value="4">第四组</option> <option value="5">第五组</option> </select> </td> <td> <div style="text-align: center;"> <a href="#">修改</a> </div> </td> </tr> </foreach> </form></code>
This is my template
I want to make
This is the data I passed from the background to the template
<code><form action="{:U('Admin/Change/changegroup')}" method="post" accept-charset="utf-8"> <foreach name="data" item="v"> <tr> <td align="center"> <font>{++$i}</font> </td> <td align="center"> <font>{$v.admin_name}</font> </td> <td width="25%"> <select name="#" id="#" style="width: 300px;" class="span2"> <option value="1">第一组</option> <option value="2">第二组</option> <option value="3">第三组</option> <option value="4">第四组</option> <option value="5">第五组</option> </select> </td> <td> <div style="text-align: center;"> <a href="#">修改</a> </div> </td> </tr> </foreach> </form></code>
This is my template
I want to make
<code><option value="1" <eq name="v.admin_team" value="1">selected</eq>>第一组</option></code>
To be honest, it is generally more convenient to use jquery to write this kind of thing. It should be difficult to use the template syntax of thinkphp alone
Use
That’s it