I have some very simple code in a PHP web application that is something like this:
<select name="my_select" id="my_select" value="">
<option value=""></option>
<option value="1">Pass</option>
<option value="0">Fail</option>
</select>
if (empty($_POST['myselect'])) {
// if no select value is chosen, field value = current value
$field_value = $_REQUEST['field_value'];
} else {
// else set field value to select value
$field_value = $_POST['select_value'];
}
$sql = "update my table
set field_value = :field_value";
If the user chooses a value from the select list, that value is used to update a table. If the select value is empty, the field value stays as is. A button triggers the update query.
This has been working fine until today. Now, if the user selects a value, the field is updated to 1 / Pass. But if the button is clicked again and no value is chosen, the field is automatically updated to the opposite value, 0 / Fail.
I can't figure out why this is suddenly happening after it worked correctly for so long. Any input you may have would be appreciated.