I can't solve this problem:
I have a "richiesta_attestato" table with a checkbox field "invia_comunicazione".
I would like that if a record is updated and the checkbox field "invia_comunicazione" is selected (ie active, ie the value is "1") an email will be sent to recipients set in my code.
If, on the other hand, when the record is updated, the checkbox field "invia_comunicazione" is not active, no mail must be sent.
I tried this code (in after update function) but it doesn't work !!!
Code: Select all
$invio_comunicazione =sqlValue("SELECT invia_comunicazione FROM richiesta_attestato where rich_att_ID='{$selectedID}'"
);
if($invio_comunicazione =1){
// i try also with if($invio_comunicazione =1){ as i explain at the end of the code //
@mail(
// mail recipient
// da aggiungere per recuperare in automatico l'indirizzo e-mail inserito nel campo e_mail_per_info,
"[email protected], {$data['recapito_email']}",
// subject
"Sulla Buona Strada - La tua richiesta di attestato per l'attività è stata aggiornata: $titolo_evento. [Partecipante: {$data['nome']} {$data['cognome']}] ",
// message
"Abbiamo aggiornato la tua richiesta di attestato per l'attività : $titolo_evento.\n\n".
"Evento: $titolo_evento\n".
"Data: $data_evento\n".
"Luogo: $dove_evento\n".
"Orario: dalle $orario_inizio_evento alle $orario_fine_evento\n".
"$eventuali_altre_date_luoghi_orari\n\n".
"PARTECIPANTE\n".
"Nome: {$data['nome']}\n".
"Cognome: {$data['cognome']}\n\n".
"Ente: $ente_appartenenza_partecipante {$data['ente_di_appartenenza']}\n\n".
"E-mail: {$data['recapito_email']}\n".
"Telefono: {$data['recapiti_telefonici']}\n\n\n".
"Di seguito le informazioni sullo stato della tua richiesta:\n".
"{$data['stato_richiesta']}\n\n\n".
// sender address
"From: [email protected]"
);
}
- If I set the query with == 1 no email starts under any circumstances (neither with active checkbox nor with inactive checkbox)
- If I set the query with = 1 the email starts in any case (both with active checkbox and with inactive checkbox)
Can anyone help me understand where I'm wrong?
THANK YOU!
Fabiano