title: How to keep the values of dropdown list when the form is submitted in php?
body: <p>Here is the code i have written, Please do help me to solve this issue.</p>
  
  <pre><code>&lt;select name="gender" id="gender"&gt;
                      &lt;option value="M"&lt;?php if(isset($_POST['gender'])=="M"){echo "selected='selected'";}?&gt;&gt;Male&lt;/option&gt;
                      &lt;option value="F"&lt;?php if(isset($_POST['gender'])=="F"){echo "selected='selected'";}?&gt;&gt;Female&lt;/option&gt;
                      &lt;option value="O"&lt;?php if(isset($_POST['gender'])=="O"){echo "selected='selected'";}?&gt;&gt;Other&lt;/option&gt;
                      &lt;/select&gt;
  </code></pre>
  
  <p>When i submit the form by selecting Male in dropdown list, it should keep the selected value till i change that in the next submission of form. </p>
  
  <p>In the above code if i select the Male and submit the form, its showing me Others.</p>
  
  <p>so please need a little help. 
  Thanks in advance to those who would like to fix the issue. </p>