I have a table where the assistance intervals are entered. Once you've entered the line, I would like to have it sent to my final customer an email containing the summary of what's included in the table or a link that points to the table's visible page without registration.
How do I do it?
Below the code. What am I doing wrong ?
Code: Select all
function Interventi_after_insert($data, $memberInfo, &$args){
$EmailI=sqlValue("SELECT `Email` FROM `Clienti` WHERE `id`=".$data['Cliente']);
$dc=sqlValue("SELECT `Durata_ore` FROM `Contratti` WHERE `id`=".$data['Durata_contratto']);
$Clientem=sqlValue("SELECT `Ragione_Sociale` FROM `Clienti` WHERE `id`=".$data['Ragione_Sociale`']);
$Datam=sqlValue("SELECT `Data` FROM `Interventi` WHERE `id`=".$data['Cliente']);
$Descrizione_interventom=sqlValue("SELECT `Descrizione_intervento` FROM `Interventi` WHERE `id`=".$data['Cliente']);
$Durata_interventom=sqlValue("SELECT `Durata_intervento` FROM `Interventi` WHERE `id`=".$data['Cliente']);
$sum=sqlValue("SELECT sum(`Durata_intervento`) FROM `Interventi` WHERE `Cliente`=".$data['Cliente']);
$rr=$dc-$sum;
sql("UPDATE `Interventi` SET `Ore_rimanenti`='".$rr."' WHERE `id`=".$data['selectedID'],$eo);
foreach($data as $field => $value){
$messageData .= "$field: $value \n";
}
@mail(
// mail recipient
"$EmailI",
// subject
"Intervento eseguito - Consulente Tecnico Informatico",
// message
" Ho eseguito un nuovo intervento, puoi visualizzare il riepilogo ".
"Cliente: $Clientem \n" .
"Data: $Datam \n" .
"Intervento: $Descrizione_interventom \n " .
"OreContratto: $dc \n" .
"Durata: $Durata_interventom \n" .
"Ore Rimanenti: $Ore_rimanenti \n" ,
// sender address
"From: [email protected]"
);
return TRUE;
}