I intend to "bring back" some information about a user in a form, so I have to place that info into the right inputs. Some are in a select structure.
I want to select the right option from that select structure, and for that I do like this:
<select class="m-wrap span12" name="gender">
{if $obj eq '1'}
<option value="">Seleccione</option>
<option value="1" selected>Hombre</option>
<option value="2">Mujer</option>
{elseif $obj eq '2'}
<option value="">Seleccione</option>
<option value="">Hombre</option>
<option value="2" selected>Mujer</option>
{else}
<option value="0" selected>Seleccione</option>
<option value="">Hombre</option>
<option value="2">Mujer</option>
{/if}
</select>
But I want to make it shorter so I don't repeat code lines. I have tried this but with no success:
<select class="m-wrap span12" name="gender" id="{$obj}">
<option value="1" id="1">Hombre</option>
<option value="2" id="2">Mujer</option>
<option value="0" id="3">Seleccione</option>
</select>
I'm using smarty template and codeigniter.
Thanks in advance, I'm new to programming.