我在 smarty 中编码,在我的表单中有很多复选框,当我检查它然后在 DB 中正确提交它时,但我想要:当我接下来打开表单时,“应该保持检查”,如之前检查过的那样。但是我的表单不像这个功能那样工作。我有 .tpl 文件。我的代码如下:
<div class="header_text">Brand</div>
<table style="margin-left: 94px;">
{foreach from=$interests item=record}
<tr>
<td style="width: 150px;">
<div class="interest_name">
<div class="interest_name">
{$record.name}
</div>
</div>
</td>
{foreach from=$record.type item=type}
<td style="width: 150px;">
{* I want to check checkbox after form submit based on Previously selected Form Submission*}
<input type="checkbox" name="plan_type[{$record.id}][]" value="{$type}" />
{$type}
<div id="comments">
<textarea name="comments[{$record.id}][]" cols="7" rows="2" value="comment"></textarea>
</div>
</td>
{/foreach}
<td style="...">
<input type="checkbox" name="shop" value="Shop" />Shop
<textarea name="comments[{$record.id}][]" cols="7" rows="2" value="comment"></textarea>
</td>
</tr>
{/foreach}
</tr>
<div class="shaukk-buttons universal-red-button home-page-buttons">
<a herf="#">Add Details</a>
</table>
<input type="submit" value="enter" name="submit">