I want to send an email only if the field name 'Active' has changed in my database table bus_status..
It is a boolean field (TRUE or FALSE) so if it is False and changes to TRUE upon update I want it to send the email or if is TRUE and it is changed to false on update then I want it to send the email.

This code was placed into a HOOK file that has a function started called After_Update which is triggered after the record is changed.

If I just remove the first two lines of this code it will send the email when the entire record is modified at all.. But that is too many emails.. I only want to send the email when the Active field is changed which is critical for limiting the notifications.

Any Suggestions? I tried this below with no luck:

if(isset ($_POST{$data['Active']}));
// mail recipient
"user@domain.com, 2ndUser@domain.com",

// subject
"A Driver's ACTIVE STATUS HAS CHANGED - notification - Driver RECORD NUMBER-{$data['Record_Id']}",

// message
      "The above record {$data['Record_Id']} was just modified with the driver's Active Status changing from FALSE to TRUE or True to FALSE, by:{$memberInfo['username']} The record was updated on and by:{$data['LastUpdatedby']} \n To view the record please go to \n http://bigschoolbus.com/asdata2/compliance_view.php?SelectedID=".$data['selectedID']."  Newly entered data shows as actual table values below:,
     {$messageData2} \n.  The user that changed this record did so from IP Address: {$memberInfo['IP']}  \n\n", 

// sender address

return TRUE;
3 Years
Discussion Span
Last Post by iamthwee
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.