'How can I update time by condition?

Hi everyone please i need you're help.

What i want is when the input field is updated with this value: Résolu --> update column date with date now.

I have a POST form with input field:this is my code:

            <div class="d-flex col">
            <label class="form-label col-auto">Etat :</label>
            <select class="form-select" name="etat" id="etat">
                    <option value="<?=$row['etat'] ?>"><?=$row['etat'] ?></option>
                    <option value="Résolu">Résolu</option>
                    <option value="Abondonné">Abondonné</option>
            </select>
            </div>

And this is the query:

if(isset($_POST['save_suivi'])){     


$etat = $_POST['etat'];

$sql = "UPDATE tbl_ss_appareil_rec SET etat='$etat' WHERE id_rec='$id_rec'";

if (mysqli_query($con, $sql)) {
header('Location: ../ss_ficherec.php');
} else {
echo "Error: " . $sql . " " . mysqli_error($con);
}
mysqli_close($con);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source