I have a dropdown list in the form. The value is generated from
category table which has id and name field.
After select the category and click submit, I want to "selected" the
category we selected before submit (request.vars.category_name).
I'm trying to use if statement but not sure what I'm doing.
Can you help me ?
<form enctype="multipart/form-data" action="{{URL()}}" method="post">
<select name='category_name'>
{{for category in categories:}}
<option value={{=category.id}}>{{=category.Name}}
{{if category.id==request.vars.category_name:}}
selected='selected'
{{pass}}
</option>
{{pass}}
</select>
<input type="submit">
</form>