如果声明 - 发送电子邮件 - php

How i can send email when change (No) to (Yes) in PHP

My Database

----------------------------------------
|  ID  |    Send   |  Flag  |   User   |
----------------------------------------
|   1  |     No    |   0    |   John   |
----------------------------------------
|   2  |    Yes    |   1    |  Sarah   |
----------------------------------------
|   3  |    Yes    |   1    |  Layan   |
----------------------------------------

For Example :

When change (No) to (Yes) Send this email to : info@website.com

Note :

When send the email change the flag from 0 to 1, and if flag 1 don't send the same user again

The Email :

Dear Admin,

    User (Sarah) - Done
    User (Layan) - Done

Best Regards.

Assuming the data is being changed via a form on a webpage, simply compare the existing (old) value to the new value. If the updated value is "yes", send the email. You could "get" the existing (old) value in a number of ways: easiest being by passing it as a value from a hidden form field:

if($_POST['old_value_from_hidden_form_field'] == 'no' && $_POST['new_value_from_form'] == 'yes') {
    // send email
}