title: Keeping lastly selected value from a dropdownlist after button click
body: <p>Just like the title says i'm having difficulties in achieving it.</p>
  
  <p>Here's my dropdownlist:</p>
  
  <pre><code>&lt;?php
        $query = "SELECT data, rel_id FROM $tbl_rel_balansas INNER JOIN $tbl_balansas ON $tbl_rel_balansas.rel_id = $tbl_balansas.id WHERE $tbl_rel_balansas.member_id = '$_SESSION[id]' group by data";
        $result = mysql_query ($query);
        echo "&lt;select name=data value=''&gt;Data&lt;/option&gt;";
        while($nt=mysql_fetch_array($result)){
          echo "&lt;option value=$nt[data] name=\"blabla\"&gt;$nt[data]&lt;/option&gt;";
        }
        echo "&lt;/select&gt;";
  ?&gt;
  </code></pre>
  
  <p>Here's the buttonclick:</p>
  
  <pre><code>&lt;?php
        if(isset($_POST['Submit']))
        {
          $query = "SELECT SUM(suma), paskirtis FROM $tbl_rel_balansas INNER JOIN $tbl_balansas ON $tbl_rel_balansas.rel_id = $tbl_balansas.id WHERE $tbl_rel_balansas.member_id = '$_SESSION[id]'  AND data ='".$_POST['data']."' group by paskirtis";
          $result = mysql_query ($query);
          echo "&lt;tr&gt;&lt;td&gt;Paskirtis:&lt;/td&gt;&lt;td&gt;Biudzetas:&lt;/td&gt;&lt;td&gt;Isleista:&lt;/td&gt;&lt;td&gt;Likutis:&lt;/td&gt;&lt;/tr&gt;";
          while($nt=mysql_fetch_array($result)){
              if($nt['SUM(suma)'] != null){
              $suma = $nt['SUM(suma)'];
          }
              echo "&lt;tr&gt;&lt;td&gt;$nt[paskirtis]&lt;/td&gt;
              &lt;td&gt;&lt;input type=\"text\" name=\"isleista[]\" value=\"Skiriamų pinigų kiekis...\" method=\"post\"&gt;&lt;/td&gt;&lt;td&gt;".$suma." Lt&lt;/td&gt;&lt;td&gt;--&lt;/td&gt;&lt;/tr&gt; &lt;br&gt;";
          }
        }
  ?&gt;
  </code></pre>
  
  <p>After I press it, it retrieves the data I want from the date I've chosen from the drop down list and also reset whole drop down list showing the first value of the dates from sql database, not the one I selected. If anyone knows how to keep the selected value in the list any help is greatly appriciated! </p>