Jump to content

[SOLVED] MAIL() Help


Clinton

Recommended Posts

I'm running a CRON job because I can't seem to figure out how to set the $message of the mail setting when I have multiple outputs. However, instead of displaying it all pretty it shows it in the crude HTML format which isn't good for the people receiving the information. Is there any way to make this right/better?

 

<?php

$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");

$selected = mysql_select_db("clintona_SLC",$dbhandle)
or die("Can not open SLC Database");

$result = mysql_query("SELECT * FROM training ORDER BY lname");

$nowtrue = date('Y-m-d');

echo "Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>
";

while ($row=mysql_fetch_assoc($result)){ extract($row);

$driverslicense = strtotime($driverslicense.'- 1 month');

$driverslicense = date('Y-m-d',$driverslicense);

$driverslicenseexpire = strtotime($driverslicense.'+ 1 month');

$driverslicenseexpire = date('n/j/Y',$driverslicenseexpire);

if ($row{'driverslicense'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $driverslicense) {	
echo "<center> $fname $lname is due for a Drivers License renewal! It Expires $driverslicenseexpire
";
}


$cdlmedicalexpire = strtotime($cdlmedical.'+ 24 months');

$cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire);

$cdlmedical = strtotime($cdlmedical.'+ 23 months');

$cdlmedical = date('Y-m-d',$cdlmedical);

if ($row{'cdlmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $cdlmedical) {
echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire
";
}


$hazmatmedicalexpire = strtotime($hazmatmedical.'+ 12 months');

$hazmatmedicalexpire = date('n/j/Y',$hazmatmedicalexpire);

$hazmatmedical = strtotime($hazmatmedical.'+ 11 months');

$hazmatmedical = date('Y-m-d',$hazmatmedical);

if ($row{'hazmatmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazmatmedical) {
echo "<center> $fname $lname is due for a HazMat Medical Evaluation! It Expires $hazmatmedicalexpire
";
}


$kucccontractorexpire = strtotime($kucccontractor.'+ 12 months');

$kucccontractorexpire = date('n/j/Y',$kucccontractorexpire);

$kucccontractor = strtotime($kucccontractor.'+ 11 months');

$kucccontractor = date('Y-m-d',$kucccontractor);

if ($row{'kucccontractor'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kucccontractor) {
echo "<center> $fname $lname is due for KUCC Contractor Orientation! It Expires $kucccontractorexpire
";
}

$kuccehsplanexpire = strtotime($kuccehsplan.'+ 12 months');

$kuccehsplanexpire = date('n/j/Y',$kuccehsplanexpire);

$kuccehsplan = strtotime($kuccehsplan.'+ 11 months');

$kuccehsplan = date('Y-m-d',$kuccehsplan);

if ($row{'kuccehsplan'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccehsplan) {
echo "<center> $fname $lname is due to renew the KUCC Personal EH & S Plan! It Expires $kuccehsplanexpire
";
}

$kuccconcentratorexpire = strtotime($kuccconcentrator.'+ 12 months');

$kuccconcentratorexpire = date('n/j/Y',$kuccconcentratorexpire);

$kuccconcentrator = strtotime($kuccconcentrator.'+ 11 months');

$kuccconcentrator = date('Y-m-d',$kuccconcentrator);

if ($row{'kuccconcentrator'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccconcentrator) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Concentrator Program! It Expires $kuccconcentratorexpire
";
}

$kuccmineexpire = strtotime($kuccmine.'+ 12 months');

$kuccmineexpire = date('n/j/Y',$kuccmineexpire);

$kuccmine = strtotime($kuccmine.'+ 11 months');

$kuccmine = date('Y-m-d',$kuccmine);

if ($row{'kuccmine'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccmine) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Mine & Copperton Program! It Expires $kuccmineexpire
";
}

$kuccuppexpire = strtotime($kuccupp.'+ 12 months');

$kuccuppexpire = date('n/j/Y',$kuccuppexpire);

$kuccupp = strtotime($kuccupp.'+ 11 months');

$kuccupp = date('Y-m-d',$kuccupp);

if ($row{'kuccupp'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccupp) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition UPP Program! It Expires $kuccuppexpire
";
}

$kuccpmetalsexpire = strtotime($kuccpmetals.'+ 12 months');

$kuccpmetalsexpire = date('n/j/Y',$kuccpmetalsexpire);

$kuccpmetals = strtotime($kuccpmetals.'+ 11 months');

$kuccpmetals = date('Y-m-d',$kuccpmetals);

if ($row{'kuccpmetals'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccpmetals) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpmetalsexpire
";
}


$kuccpitexpire = strtotime($kuccpit.'+ 12 months');

$kuccpitexpire = date('n/j/Y',$kuccpitexpire);

$kuccpit = strtotime($kuccpit.'+ 11 months');

$kuccpit = date('Y-m-d',$kuccpit);

if ($row{'kuccpit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccpit) {
echo "<center> $fname $lname is due for the KUCC Pit License! It Expires $kuccpitexpire <p></center>";
}

$msha46expire = strtotime($msha46.'+ 12 months');

$msha46expire = date('n/j/Y',$msha46expire);

$msha46 = strtotime($msha46.'+ 11 months');

$msha46 = date('Y-m-d',$msha46);

if ($row{'msha46'}=='0000-00-00') echo " "; 

elseif($nowtrue > $msha46) {
echo "<center> $fname $lname is due for MSHA Part 46 Training! It Expires $msha46expire
";
}

$msha48expire = strtotime($msha48.'+ 12 months');

$msha48expire = date('n/j/Y',$msha48expire);

$msha48 = strtotime($msha48.'+ 11 months');

$msha48 = date('Y-m-d',$msha48);

if ($row{'msha48'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $msha48) {
echo "<center> $fname $lname is due for MSHA Part 48 Training! It Expires $msha48expire
";
}

$mvrcheckexpire = strtotime($mvrcheck.'+ 12 months');

$mvrcheckexpire = date('n/j/Y',$mvrcheckexpire);

$mvrcheck = strtotime($mvrcheck.'+ 11 months');

$mvrcheck = date('Y-m-d',$mvrcheck);

if ($row{'mvrcheck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $mvrcheck) {
echo "<center> $fname $lname is due for an MVR Check! It Expires $mvrcheckexpire
";
}

$respiratorfitexpire = strtotime($respiratorfit.'+ 12 months');

$respiratorfitexpire = date('n/j/Y',$respiratorfitexpire);

$respiratorfit = strtotime($respiratorfit.'+ 11 months');

$respiratorfit = date('Y-m-d',$respiratorfit);

if ($row{'respiratorfit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $respiratorfit) {
echo "<center> $fname $lname is due for a Respirator Fit Test! It Expires $respiratorfitexpire
";
}

$respiratormedicalexpire = strtotime($respiratormedical.'+ 12 months');

$respiratormedicalexpire = date('n/j/Y',$respiratormedicalexpire);

$respiratormedical = strtotime($respiratormedical.'+ 11 months');

$respiratormedical = date('Y-m-d',$respiratormedical);

if ($row{'respiratormedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $respiratormedical) {
echo "<center> $fname $lname is due for a Respirator Medical Evaluation! It Expires $respiratormedicalexpire
";
}

$substance9expire = strtotime($substance9.'+ 12 months');

$substance9expire = date('n/j/Y',$substance9expire);

$substance9 = strtotime($substance9.'+ 11 months');

$substance9 = date('Y-m-d',$substance9);

if ($row{'substance9'}=='0000-00-00') echo " "; 

elseif($nowtrue > $substance9) {
echo "<center> $fname $lname is due for a NIDA 9-Panel Drug Test! It Expires $substance9expire
";
}

$naislifttruckexpire = strtotime($naislifttruck.'+ 24 months');

$naislifttruckexpire = date('n/j/Y',$naislifttruckexpire);

$naislifttruck = strtotime($naislifttruck.'+ 23 months');

$naislifttruck = date('Y-m-d',$naislifttruck);

if ($row{'naislifttruck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naislifttruck) {
echo "<center> $fname $lname is due for the NAIS Task Training Lift Truck Training! It Expires $naislifttruckexpire
";
}

$naisoverheadcraneexpire = strtotime($naisoverheadcrane.'- 1 month');

$naisoverheadcraneexpire = date('Y-m-d',$naisoverheadcraneexpire);

$naisoverheadcrane = strtotime($naisoverheadcrane.'+ 1 month');

$naisoverheadcrane = date('n/j/Y',$naisoverheadcrane);

if ($row{'naisoverheadcrane'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naisoverheadcrane) {
echo "<center> $fname $lname is due for Overhead Crane Re-Training! It Expires $naisoverheadcrane
";
}

$fmchazexpire = strtotime($fmchaz.'+ 12 months');

$fmchazexpire = date('n/j/Y',$fmchazexpire);

$fmchaz = strtotime($fmchaz.'+ 11 months');

$fmchaz = date('Y-m-d',$fmchaz);

if ($row{'fmchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $fmchaz) {
echo "<center> $fname $lname is due for FMC Corp. Retraining! It Expires $fmchazexpire
";
}

$solvayhazexpire = strtotime($solvayhaz.'+ 12 months');

$solvayhazexpire = date('n/j/Y',$solvayhazexpire);

$solvayhaz = strtotime($solvayhaz.'+ 11 months');

$solvayhaz = date('Y-m-d',$solvayhaz);

if ($row{'solvayhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $solvayhaz) {
echo "<center> $fname $lname is due for Solvay Chemicals Retraining! It Expires $solvayhazexpire
";
}

$barrickhazexpire = strtotime($barrickhaz.'+ 12 months');

$barrickhazexpire = date('n/j/Y',$barrickhazexpire);

$barrickhaz = strtotime($barrickhaz.'+ 11 months');

$barrickhaz = date('Y-m-d',$barrickhaz);

if ($row{'barrickhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $barrickhaz) {
echo "<center> $fname $lname is due for Barrick Goldstrike Retraining! It Expires $barrickhazexpire
";
}

$uitchazexpire = strtotime($uitchaz.'+ 12 months');

$uitchazexpire = date('n/j/Y',$uitchazexpire);

$uitchaz = strtotime($uitchaz.'+ 11 months');

$uitchaz = date('Y-m-d',$uitchaz);

if ($row{'uitchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $uitchaz) {
echo "<center> $fname $lname is due for UITC Retraining! It Expires $uitchazexpire
";
}

$newmonthazexpire = strtotime($newmonthaz.'+ 12 months');

$newmonthazexpire = date('n/j/Y',$newmonthazexpire);

$newmonthaz = strtotime($newmonthaz.'+ 11 months');

$newmonthaz = date('Y-m-d',$newmonthaz);

if ($row{'newmonthaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $newmonthaz) {
echo "<center> $fname $lname is due for Newmont Retraining! It Expires $newmonthazexpire 
";
}

$genchemhazexpire = strtotime($genchemhaz.'+ 12 months');

$genchemhazexpire = date('n/j/Y',$genchemhazexpire);

$genchemhaz = strtotime($genchemhaz.'+ 11 months');

$genchemhaz = date('Y-m-d',$genchemhaz);

if ($row{'genchemhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $genchemhaz) {
echo "<center> $fname $lname is due for General Chemicals Retraining! It Expires $genchemhazexpire
";
}

$hazwoper40expire = strtotime($hazwoper40.'+ 12 months');

$hazwoper40expire = date('n/j/Y',$hazwoper40expire);

$hazwoper40 = strtotime($hazwoper40.'+ 11 months');

$hazwoper40 = date('Y-m-d',$hazwoper40);

if ($row{'hazwoper40'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper40) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper40expire
";
}

$hazwoper24expire = strtotime($hazwoper24.'+ 12 months');

$hazwoper24expire = date('n/j/Y',$hazwoper24expire);

$hazwoper24 = strtotime($hazwoper24.'+ 11 months');

$hazwoper24 = date('Y-m-d',$hazwoper24);

if ($row{'hazwoper24'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper24) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper24expire
";
}

$firstaidcprexpire = strtotime($firstaidcpr.'+ 12 months');

$firstaidcprexpire = date('n/j/Y',$firstaidcprexpire);

$firstaidcpr = strtotime($firstaidcpr.'+ 11 months');

$firstaidcpr = date('Y-m-d',$firstaidcpr);

if ($row{'firstaidcpr'}=='0000-00-00') echo " "; 

elseif($nowtrue > $firstaidcpr) {
echo "<center>
$fname $lname is due for a First-Aid/CPR Refresher Course! It Expires $firstaidcprexpire
";


}}

?>

Link to comment
Share on other sites

Okay, so I tired adding the MAIL script to the code, as seen below but am getting an error. Any ideas?

 

Error: Parse error: syntax error, unexpected T_STRING in trainingcheck.php on line 22

 


<?php

$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");

$selected = mysql_select_db("clintona_SLC",$dbhandle)
or die("Can not open SLC Database");

$result = mysql_query("SELECT * FROM training ORDER BY lname");

$nowtrue = date('Y-m-d');

$email = "binaryblaster@gmail.com";

$subject = "NorthAmerican Expiring Training Report"; 
$message = "

echo "Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>
";

while ($row=mysql_fetch_assoc($result)){ extract($row);

$driverslicense = strtotime($driverslicense.'- 1 month');

$driverslicense = date('Y-m-d',$driverslicense);

$driverslicenseexpire = strtotime($driverslicense.'+ 1 month');

$driverslicenseexpire = date('n/j/Y',$driverslicenseexpire);

if ($row{'driverslicense'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $driverslicense) {	
echo "<center> $fname $lname is due for a Drivers License renewal! It Expires $driverslicenseexpire
";
}


$cdl = strtotime($driverslicense.'- 1 month');

$cdl = date('Y-m-d',$cdl);

$cdlexpire = strtotime($cdlexpire.'+ 1 month');

$cdlexpire = date('n/j/Y',$cdlexpire);

if ($row{'cdl'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $cdl) {	
echo "<center> $fname $lname is due for a CDL renewal! It Expires $cdlexpire
";
}


$cdlmedicalexpire = strtotime($cdlmedical.'+ 24 months');

$cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire);

$cdlmedical = strtotime($cdlmedical.'+ 23 months');

$cdlmedical = date('Y-m-d',$cdlmedical);

if ($row{'cdlmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $cdlmedical) {
echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire
";
}


$hazmatmedicalexpire = strtotime($hazmatmedical.'+ 12 months');

$hazmatmedicalexpire = date('n/j/Y',$hazmatmedicalexpire);

$hazmatmedical = strtotime($hazmatmedical.'+ 11 months');

$hazmatmedical = date('Y-m-d',$hazmatmedical);

if ($row{'hazmatmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazmatmedical) {
echo "<center> $fname $lname is due for a HazMat Medical Evaluation! It Expires $hazmatmedicalexpire
";
}


$kucccontractorexpire = strtotime($kucccontractor.'+ 12 months');

$kucccontractorexpire = date('n/j/Y',$kucccontractorexpire);

$kucccontractor = strtotime($kucccontractor.'+ 11 months');

$kucccontractor = date('Y-m-d',$kucccontractor);

if ($row{'kucccontractor'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kucccontractor) {
echo "<center> $fname $lname is due for KUCC Contractor Orientation! It Expires $kucccontractorexpire
";
}

$kuccehsplanexpire = strtotime($kuccehsplan.'+ 12 months');

$kuccehsplanexpire = date('n/j/Y',$kuccehsplanexpire);

$kuccehsplan = strtotime($kuccehsplan.'+ 11 months');

$kuccehsplan = date('Y-m-d',$kuccehsplan);

if ($row{'kuccehsplan'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccehsplan) {
echo "<center> $fname $lname is due to renew the KUCC Personal EH & S Plan! It Expires $kuccehsplanexpire
";
}

$kuccconcentratorexpire = strtotime($kuccconcentrator.'+ 12 months');

$kuccconcentratorexpire = date('n/j/Y',$kuccconcentratorexpire);

$kuccconcentrator = strtotime($kuccconcentrator.'+ 11 months');

$kuccconcentrator = date('Y-m-d',$kuccconcentrator);

if ($row{'kuccconcentrator'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccconcentrator) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Concentrator Program! It Expires $kuccconcentratorexpire
";
}

$kuccmineexpire = strtotime($kuccmine.'+ 12 months');

$kuccmineexpire = date('n/j/Y',$kuccmineexpire);

$kuccmine = strtotime($kuccmine.'+ 11 months');

$kuccmine = date('Y-m-d',$kuccmine);

if ($row{'kuccmine'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccmine) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Mine & Copperton Program! It Expires $kuccmineexpire
";
}

$kuccuppexpire = strtotime($kuccupp.'+ 12 months');

$kuccuppexpire = date('n/j/Y',$kuccuppexpire);

$kuccupp = strtotime($kuccupp.'+ 11 months');

$kuccupp = date('Y-m-d',$kuccupp);

if ($row{'kuccupp'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccupp) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition UPP Program! It Expires $kuccuppexpire
";
}

$kuccpmetalsexpire = strtotime($kuccpmetals.'+ 12 months');

$kuccpmetalsexpire = date('n/j/Y',$kuccpmetalsexpire);

$kuccpmetals = strtotime($kuccpmetals.'+ 11 months');

$kuccpmetals = date('Y-m-d',$kuccpmetals);

if ($row{'kuccpmetals'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccpmetals) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpmetalsexpire
";
}


$kuccpitexpire = strtotime($kuccpit.'+ 12 months');

$kuccpitexpire = date('n/j/Y',$kuccpitexpire);

$kuccpit = strtotime($kuccpit.'+ 11 months');

$kuccpit = date('Y-m-d',$kuccpit);

if ($row{'kuccpit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccpit) {
echo "<center> $fname $lname is due for the KUCC Pit License! It Expires $kuccpitexpire <p></center>";
}

$msha46expire = strtotime($msha46.'+ 12 months');

$msha46expire = date('n/j/Y',$msha46expire);

$msha46 = strtotime($msha46.'+ 11 months');

$msha46 = date('Y-m-d',$msha46);

if ($row{'msha46'}=='0000-00-00') echo " "; 

elseif($nowtrue > $msha46) {
echo "<center> $fname $lname is due for MSHA Part 46 Training! It Expires $msha46expire
";
}

$msha48expire = strtotime($msha48.'+ 12 months');

$msha48expire = date('n/j/Y',$msha48expire);

$msha48 = strtotime($msha48.'+ 11 months');

$msha48 = date('Y-m-d',$msha48);

if ($row{'msha48'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $msha48) {
echo "<center> $fname $lname is due for MSHA Part 48 Training! It Expires $msha48expire
";
}

$mvrcheckexpire = strtotime($mvrcheck.'+ 12 months');

$mvrcheckexpire = date('n/j/Y',$mvrcheckexpire);

$mvrcheck = strtotime($mvrcheck.'+ 11 months');

$mvrcheck = date('Y-m-d',$mvrcheck);

if ($row{'mvrcheck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $mvrcheck) {
echo "<center> $fname $lname is due for an MVR Check! It Expires $mvrcheckexpire
";
}

$respiratorfitexpire = strtotime($respiratorfit.'+ 12 months');

$respiratorfitexpire = date('n/j/Y',$respiratorfitexpire);

$respiratorfit = strtotime($respiratorfit.'+ 11 months');

$respiratorfit = date('Y-m-d',$respiratorfit);

if ($row{'respiratorfit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $respiratorfit) {
echo "<center> $fname $lname is due for a Respirator Fit Test! It Expires $respiratorfitexpire
";
}

$respiratormedicalexpire = strtotime($respiratormedical.'+ 12 months');

$respiratormedicalexpire = date('n/j/Y',$respiratormedicalexpire);

$respiratormedical = strtotime($respiratormedical.'+ 11 months');

$respiratormedical = date('Y-m-d',$respiratormedical);

if ($row{'respiratormedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $respiratormedical) {
echo "<center> $fname $lname is due for a Respirator Medical Evaluation! It Expires $respiratormedicalexpire
";
}

$substance9expire = strtotime($substance9.'+ 12 months');

$substance9expire = date('n/j/Y',$substance9expire);

$substance9 = strtotime($substance9.'+ 11 months');

$substance9 = date('Y-m-d',$substance9);

if ($row{'substance9'}=='0000-00-00') echo " "; 

elseif($nowtrue > $substance9) {
echo "<center> $fname $lname is due for a NIDA 9-Panel Drug Test! It Expires $substance9expire
";
}

$naislifttruckexpire = strtotime($naislifttruck.'+ 24 months');

$naislifttruckexpire = date('n/j/Y',$naislifttruckexpire);

$naislifttruck = strtotime($naislifttruck.'+ 23 months');

$naislifttruck = date('Y-m-d',$naislifttruck);

if ($row{'naislifttruck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naislifttruck) {
echo "<center> $fname $lname is due for the NAIS Task Training Lift Truck Training! It Expires $naislifttruckexpire
";
}

$naisoverheadcraneexpire = strtotime($naisoverheadcrane.'- 1 month');

$naisoverheadcraneexpire = date('Y-m-d',$naisoverheadcraneexpire);

$naisoverheadcrane = strtotime($naisoverheadcrane.'+ 1 month');

$naisoverheadcrane = date('n/j/Y',$naisoverheadcrane);

if ($row{'naisoverheadcrane'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naisoverheadcrane) {
echo "<center> $fname $lname is due for Overhead Crane Re-Training! It Expires $naisoverheadcrane
";
}

$fmchazexpire = strtotime($fmchaz.'+ 12 months');

$fmchazexpire = date('n/j/Y',$fmchazexpire);

$fmchaz = strtotime($fmchaz.'+ 11 months');

$fmchaz = date('Y-m-d',$fmchaz);

if ($row{'fmchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $fmchaz) {
echo "<center> $fname $lname is due for FMC Corp. Retraining! It Expires $fmchazexpire
";
}

$solvayhazexpire = strtotime($solvayhaz.'+ 12 months');

$solvayhazexpire = date('n/j/Y',$solvayhazexpire);

$solvayhaz = strtotime($solvayhaz.'+ 11 months');

$solvayhaz = date('Y-m-d',$solvayhaz);

if ($row{'solvayhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $solvayhaz) {
echo "<center> $fname $lname is due for Solvay Chemicals Retraining! It Expires $solvayhazexpire
";
}

$barrickhazexpire = strtotime($barrickhaz.'+ 12 months');

$barrickhazexpire = date('n/j/Y',$barrickhazexpire);

$barrickhaz = strtotime($barrickhaz.'+ 11 months');

$barrickhaz = date('Y-m-d',$barrickhaz);

if ($row{'barrickhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $barrickhaz) {
echo "<center> $fname $lname is due for Barrick Goldstrike Retraining! It Expires $barrickhazexpire
";
}

$uitchazexpire = strtotime($uitchaz.'+ 12 months');

$uitchazexpire = date('n/j/Y',$uitchazexpire);

$uitchaz = strtotime($uitchaz.'+ 11 months');

$uitchaz = date('Y-m-d',$uitchaz);

if ($row{'uitchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $uitchaz) {
echo "<center> $fname $lname is due for UITC Retraining! It Expires $uitchazexpire
";
}

$newmonthazexpire = strtotime($newmonthaz.'+ 12 months');

$newmonthazexpire = date('n/j/Y',$newmonthazexpire);

$newmonthaz = strtotime($newmonthaz.'+ 11 months');

$newmonthaz = date('Y-m-d',$newmonthaz);

if ($row{'newmonthaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $newmonthaz) {
echo "<center> $fname $lname is due for Newmont Retraining! It Expires $newmonthazexpire 
";
}

$genchemhazexpire = strtotime($genchemhaz.'+ 12 months');

$genchemhazexpire = date('n/j/Y',$genchemhazexpire);

$genchemhaz = strtotime($genchemhaz.'+ 11 months');

$genchemhaz = date('Y-m-d',$genchemhaz);

if ($row{'genchemhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $genchemhaz) {
echo "<center> $fname $lname is due for General Chemicals Retraining! It Expires $genchemhazexpire
";
}

$hazwoper40expire = strtotime($hazwoper40.'+ 12 months');

$hazwoper40expire = date('n/j/Y',$hazwoper40expire);

$hazwoper40 = strtotime($hazwoper40.'+ 11 months');

$hazwoper40 = date('Y-m-d',$hazwoper40);

if ($row{'hazwoper40'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper40) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper40expire
";
}

$hazwoper24expire = strtotime($hazwoper24.'+ 12 months');

$hazwoper24expire = date('n/j/Y',$hazwoper24expire);

$hazwoper24 = strtotime($hazwoper24.'+ 11 months');

$hazwoper24 = date('Y-m-d',$hazwoper24);

if ($row{'hazwoper24'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper24) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper24expire
";
}

$firstaidcprexpire = strtotime($firstaidcpr.'+ 12 months');

$firstaidcprexpire = date('n/j/Y',$firstaidcprexpire);

$firstaidcpr = strtotime($firstaidcpr.'+ 11 months');

$firstaidcpr = date('Y-m-d',$firstaidcpr);

if ($row{'firstaidcpr'}=='0000-00-00') echo " "; 

elseif($nowtrue > $firstaidcpr) {
echo "<center>
$fname $lname is due for a First-Aid/CPR Refresher Course! It Expires $firstaidcprexpire
";


}}

";
mail($email, $subject, $message,
"From: NorthAmerican Services Group<binaryblaster@gmail.com>\n 
X-Mailer: PHP/" . phpversion());

?>

Link to comment
Share on other sites

Ok, I'll make it easier as I figured out the hard part. How do I get the VARIABLE in the $message to echo out it's results?

 

$email = 'blah@gmail.com';
$subject = 'Weekly Training Expiring Report'; 
$message = '<html>
<center><font color=green> LAKE CITY TRAINING EXPIRING REPORT<p></font>
Expiring Driver Licenses<p></html>
$driverlicensemail

';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Me Services Group <blah@gmail.com>' . "\r\n";
mail($email, $subject, $message, $headers);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.