ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

condition if then in emails

ErixSr 06 Dec, 2017
Hello everyone,
I can not figure out how to do the if-then condition in the email.
I tried:

<td colspan="2" align="center"><b>L'indirizzo di spedizione è lo stesso?:</b> <b><font size="3" color="red">{spedizione}</font></td></tr>

<?php
$Risp = "{spedizione}";

if ($Risp = "Si") { 
  echo 'La risposta è SI';
} else { 
  echo 'La risposta è No';
}
?>

</table><br>


Where {spedizione} is a radiobutton, the answer is: Si / No

If I select Yes or select No, the answer is always there "La risposta è SI"

Where am I wrong?
GreyHead 06 Dec, 2017
Answer
Hi ErixSr,

You can't use the {input_name} syntax in PHP please use $form->data['input_name'] instead. You also need == in the if statement, not just = e,g,
<?php
if ( $form->data['spedizione'] == "Si" ) { 
echo 'La risposta è SI';
} else { 
echo 'La risposta è No';
}
?>
Bob
ErixSr 06 Dec, 2017
Tiredness and especially lack of preparation make stupid questions like mine ...
Thank you Bob,
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com