I know there are a lot of questions related to it but believe me, no solution is working for me.
<form action="index" method="post" >
<select id="s" name="dtype" class="dropdown" required
style="float: left; text-align: left;width: 20%; margin: 10px;">
<option value="400">Select Data Type</option>
<option value="401">Current</option>
<option value="402">Voltage</option>
<option value="403">kWh</option>
</select>
</form>
What I have tried
I have tried the following
<option <?php if ($_GET['dtype'] == '401') { ?>selected="true" <?php }; ?>value="401">Current</option>
<option <?php if ($_GET['dtype'] == '402') { ?>selected="true" <?php }; ?>value="402">Voltage</option>
<option <?php if ($_GET['dtype'] == '402') { ?>selected="true" <?php }; ?>value="402">kwh</option>
Tried below solution
All the solution gives me unidentified index: dtype
error
Any help would be highly appreciated.