Hello,
I have a table with about 10 fields where the user has three options, "Done", "Pending", "N/A". If the user selects "Pending" in any field this list would be mark as incomplete, but if there is not "Pending" in any field I need to send an email, right now with the code I wrote, the email is sent either way, if there is "Pending" or not on any field,
I hope I made sense. Thanks for your help.
function check_pend ($values){
foreach($values as $k => $v)
{
if($values[$k] == "Pending"){
//echo $k . " keys <br/>";
return false;
}else if($values[$k] != "Pending"){
return true;
}
}
}
if(check_pend($values) == true){
$services = array();
foreach($values as $k => $v)
{
if($values[$k] == "N/A"){
$services[] = $k;
}
}
$msg = 'Please check, the following services WILL NOT be included in thise case: <br/>';
$count = count($services);
for ($i=0;$i<=$count;$i++){
$msg .= strtoupper($services[$i]) . "<br/>";
}
// ********** Send simple email ************
$email = "xxxxxxxxxxx";
$from = "Agape Check List<xxxxxxxxxxxx>";
$subject = "Double Check Task For: [". $values['deceased_name']."]";
echo $msg;
//$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $msg, 'from'=>$from);
}