I'm writing the html codes in php file.
I have a dropdown to allow user query results with month & year that looks like this.
The query search on default current month and year, but for example when I search for April 2018, the results are be correct , but the dropdown selectoption still display July 2018.
My codes:
<table width="80%" border="0" align="center" cellpadding="7" cellspacing="2">
<tr bgcolor="#ffffff">
<td height="6" colspan="2" bgcolor="#E6E6FA">
Month
<select name="soutlet" id="soutlet">
<option selected="selected" value="7">July</option>
<option value="">-----------</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
Year
<select name="soutletto" id="soutletto">
<option selected="selected" value="2018">2018</option>
<option value="">-----</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
</select>
<input type="submit" name="btn_search" id="btn_search" value="Search" ></td>
</tr>
How do I modify my html codes in order the dropdown showing the correct month and year? If I search for April 2018 it will shows


selected="selected"to the option you want to be selectedifstatement that checks for the submitted value