Option selected through jQuery


#1

I have an iddue where I have a looped option form where itll loop all my data into the option form. When I push a button itll reload the whole page, which is something I need to fix but for now I want to get this form to keep the value of the LAST one used.

<label>Battle</label>
  <form method="post" action="index.php?mod=Battle">
    <select name="selection">
      {foreach from=$mobs item=mob}
        <option value="{$mob->id}">{$mob->name} ({$mob->id})</option>
      {/foreach}
    </select>
    <input name="battle_mob" type="submit" value="Fight" class="button" />
  </form>

I have been trying to figure out how to do this. I have a it where itll set a value in the DB for players of their “lastmob” killed to the value of that said mob. I tried using a if statement inside the option tag, was a long shot but I tried it lol.