Forums

Adding PHP to change email text

Beyer 05 May, 2010
I currently have an email being set out to an individual. Based on a radio box the individual selects, a different email should be sent (minimal textual changes in the email based on the radio selection).

I read to use the following in the On Submit code - before sending email:

<?php
$radio = JRequest::getString('radio0', '', 'post');
switch ($radio0) {
   case 'Outstanding Achievement in the Human Services Field for a Program (or Project)':
      JRequest::setVar('awardTitle', 'Program Nomination');
      break;
   
   case 'Outstanding Achievement in the Human Services Field for a Professional':
      JRequest::setVar('awardTitle', 'Individual');
      break;
}
?>


I read to make sure the HTML template was turned off.

I have the following code in my email template:


<p><span style="font-family: arial,helvetica,sans-serif;"> <strong>
<?php
echo 'the radio selection is ' .$awardTitle;
?>
</strong></span></p>


Upon submission, I do NOT receive the output of $awardTitle. What am I doing wrong?

Thanks,
ClayB
Beyer 05 May, 2010
Extra information...

this does not produce the awardTitle variable either:


<p><span style="font-family: arial,helvetica,sans-serif;"> <strong>
the title is {awardTitle}
</strong></span></p>
GreyHead 06 May, 2010
Hi Beyer,

A little typo has crept in. You are putting the value in $radio but switching on $radio0
$radio = JRequest::getString('radio0', '', 'post');
switch ($radio0) {
If you correct that then the {awardTitle} version should work OK.,

Bob
Beyer 06 May, 2010
BAH! I knew it was something small and simple, lol.

Thanks a bunch,
ClayB
This topic is locked and no more replies can be posted.