Front-End Entry (Guest) saving correct values on error I'm building a Guest Entry Form, and one of the fields is a dropdown. Everything feeds through fine, but if one of the other fields has a validation error, I can save any inputted data with the code as outlined in the Entry Form 

&lt;input id="customField" type="text" name="fields[customField]"
{%- if entry is defined %} value="{{ entry.customField }}"{% endif -%}&gt;


But, with the dropdown, I can't get the value to stick, it always defaults to the first option (It's to grab a name title - eg, Mr. Mrs, Miss etc) on an error:

&lt;select name="fields[honorific]"&gt;
    {% for honortitle in entry.honorific.options %}
        &lt;option {%- if entry is defined %} value="{{ honortitle.value }}{% endif -%}"&gt;{% if entry is defined %}{{ honortitle.value }}&lt;/option&gt;
    {% endfor %}
&lt;/select&gt;


So, if I've already selected the option at the bottom of the list, how do I get the field to remember what I've selected if there's an error elsewhere?

Thanks, Simon
Digging into a past solution for checkboxes thanks to @bradbell, here's the answer!

 &lt;select name="fields[honorific]"&gt;
     {% for honortitle in entry.honorific.options %}
         {% set chosen = false %}

         {% if honortitle.selected %}
             {% set chosen = true %}
         {% endif %}

         &lt;option value="{{ honortitle.value }}"{% if chosen %} selected{% endif %}&gt;{{ honortitle.label }}&lt;/option&gt;
    {% endfor %}
 &lt;/select&gt;