Welcome Guest, Not a member yet? Register   Sign In
how to keep current select value after submit
#2

[eluser]memVN[/eluser]
hi you
Code:
<select class="default" name="diadiem">
<option value="--">--</option>;
   &lt;?php  
      foreach($tinhthanhpho as $diadiem)
         {
               echo "<option value='".$diadiem['id']."' >".$diadiem['ten_tinh']."</option>";
                                }                      
     ?&gt;
</select>

Please change to
Code:
<select class="default" name="diadiem">
<option value="--">--</option>

    &lt;?php foreach($tinhthanhpho as $diadiem) : ?&gt;
          <option value="&lt;?=$diadiem['id']?&gt;" &lt;?php if(@$_POST['diadiem'] == $diadiem['id']) echo "selected=selected"; ?&gt;>&lt;?=$diadiem['ten_tinh']?&gt;</option>                    
    &lt;?php endforeach ?&gt;
</select>


Messages In This Thread
how to keep current select value after submit - by El Forum - 10-24-2012, 06:40 AM
how to keep current select value after submit - by El Forum - 10-24-2012, 07:45 AM
how to keep current select value after submit - by El Forum - 11-19-2012, 09:20 PM
how to keep current select value after submit - by El Forum - 01-27-2013, 07:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB