Here is the code I wrote, please help me solve this problem.
<select name="gender" id="gender">
<option value="M"<?php if(isset($_POST['gender'])=="M"){echo "selected='selected'";}?>>Male</option>
<option value="F"<?php if(isset($_POST['gender'])=="F"){echo "selected='selected'";}?>>Female</option>
<option value="O"<?php if(isset($_POST['gender'])=="O"){echo "selected='selected'";}?>>Other</option>
</select>
When I submit the form, selecting “Male” from the drop-down list, it should save the selected value until I change it in the next view of the form.
In the above code, if I select Male and submit the form, it will show me the others.
so you need a little help. Thanks in advance to those who would like to fix the problem.
source
share