title: Setting a select's selected value to "selected" after form submit and page refresh
body: <p>I have an asp form handler posting form data from a select to call a database function. My functionality seems to work just fine but I need to find a way to set the posted option to &quot;selected&quot; after the form has been submitted. Due to the page refresh, the form just resets to its default selected value - not the posted form value.</p>
  <p>Here is my form:</p>
  <pre><code>            &lt;form method=&quot;post&quot; asp-page-handler=&quot;location&quot; class=&quot;location-container&quot;&gt;
  
              &lt;select class=&quot;location-picker&quot; name=&quot;location_id&quot; value=&quot;1&quot;&gt;
                  &lt;option class=&quot;option1&quot; value=&quot;1&quot;&gt;Bloom Headquarters&lt;/option&gt;
                  &lt;option class=&quot;option2&quot; value=&quot;2&quot;&gt;Peony Place&lt;/option&gt;
                  &lt;option class=&quot;option3&quot; value=&quot;3&quot;&gt;Carnation Corner&lt;/option&gt;
              &lt;/select&gt;
  
              &lt;input class=&quot;btn confirm&quot; type=&quot;submit&quot; value=&quot;CHANGE&quot; style=&quot;float:left;&quot; /&gt;
          &lt;/form&gt;
  </code></pre>
  <p>Is there anything I can do in the backend to call the location id of the submitted form and set the select's selected value to that submitted value? Do I need to use local storage or a URL query perhaps?</p>