title: dropdown menu using for loop not retaining value in dropdown
body: <p>Hi i am developing an application using laravel 4, i have a drop down menu which generate values using for each loop the problem here is once if i select a value and save the form the value gets saved in database but when i try to edit the same it's getting retained to the default value so my question is how to retain previously selected the drop down value?</p>
  
  <p>Here is my code please take a look</p>
  
  <pre><code>&lt;form class="form-horizontal" method="post" action="" autocomplete="off"&gt;
  &lt;div class="form-group {{ $errors-&gt;has('last_closing_financial_year') ? 'has-error' : '' }}"&gt;
      &lt;label class="control-label" for="last_closing_financial_year"&gt;Enter the Last Closing Financial Year&lt;/label&gt;
          &lt;div class="controls"&gt;
              &lt;?php
                  $years = array();
                  for ($i = 1980; $i &lt; 2050; $i++)
                  {                       
                    $years[] = $i;
                  } 
                  echo '&lt;select name="last_closing_financial_year" class="controls assettext select2 selectyear" id="last_closing_financial_year" &gt;';
                  echo '&lt;option value=""&gt;-- Select Year --&lt;/option&gt;';
                  foreach($years as $option)
                  {
                      echo "&lt;option value='{$option}'";
                      $optionprev= $option+1;
                      echo "&gt;{$option}-{$optionprev}&lt;/option&gt;";   
                  }  
                  echo "&lt;/select&gt;"."&amp;nbsp;(On or Before User cannot Calculate this Year)";    
              ?&gt;
          &lt;/div&gt;  
          {{ $errors-&gt;first('last_closing_financial_year', '&lt;span class="alert-msg"&gt;&lt;i class="icon-remove-sign"&gt;&lt;/i&gt; :message&lt;/span&gt;') }}
  &lt;/div&gt;
  &lt;button type="submit" class="btn-flat success"&gt;&lt;i class="icon-ok icon-white"&gt;&lt;/i&gt;save &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Please let me know if you something needed...</p>
  
  <p>I tried many possible duplicate of this question but nothing worked.</p>
  
  <p>I also tried this with no luck</p>
  
  <pre><code>$selected = "-- Select Year --";
  foreach($years as $option)
  {
       if($selected == $option){
        echo "&lt;option selected='selected' value='$option'&gt;$option&lt;/option&gt;" ;
       }                                               
       else{
        echo "&lt;option value='$option'&gt;$option&lt;/option&gt;" ;
       }
  }
  </code></pre>
  
  <p>Thanks in advance.........</p>