Okay, Now I have most of my trip sheet done. I am having one last problem maybe someone could help out. Only in the edit if they mark the checkbox to complete I need that to shoot off an email. here is what I got in EVENT - Edit - Before record updated:
//********** Check if Trip is LOCKED ************
$rs = DB::Query("SELECT * FROM trip_sheet WHERE locked = '1' ");
$data=$rs->fetchAssoc();
if($data)
{
//********** Start Send email when Trip Marked Complete ************
$email= "MY EMAIL";
$from= "From Email";
$fromName= "FROM WHOME";
$msg= "Here is a trip that has been marked COMPLETE\r\n";
$subject= "Trip Marked Complete";
$msg.= "Name: ".$values["driver_name"]."\r\n";
$msg.= "Truck Number: ".$values["truck_number"]."\r\n";
$msg.= "Trip Number: ".$values["trip_number"]."\r\n";
$msg.= "Link to Trip:MYDOMAIN/trip_sheet_view.php?editid1=".$values["trip_id"]."&\r\n";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'fromName'=> $fromName, 'from' => $from));
if(!$ret["mailed"])
echo $ret["message"];
//********** END Send email when Trip Marked Complete ************
}
else
{
// if dont exist do something else
}
// Place event code here.
// Use "Add Action" button to add code snippets.
return true;
The email sends off fine. The problem is it will send off if the checkbox is checked or not so the bad part in this code I think is around:
$rs = DB::Query("SELECT * FROM trip_sheet WHERE locked = '1' ");
$data=$rs->fetchAssoc();
Please let me know if I am on the right path..
Thanks
James