• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: SOLVED - Code for different emails based selection

SOLVED - Code for different emails based selection 12 years 1 month ago #22344

  • jkammert
  • jkammert's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Thank you received: 1
Hello all I thought I would supply everyone with an answer from the support team on this much asked question.

Here is my original email:

I need to create a PHP Email Script so that the body of the user email message is different based on the radio button selected for a field called 'Contact Type'.

For this example we will say that they can select value 'A', 'B' or 'C'. Based on the selected value then it will send a different email message.

Here is the code that I have so far:
if($_POST['form']['Contact Type'][0] == 'Parent')
$userEmail['text'][] = 'This is a <b>Contact Type A</b>';
if($_POST['form']['Contact Type'][1] == 'Educator')
$userEmail['text'][] = 'This is a <b>Contact Type B</b>';
if($_POST['form']['Contact Type'][2] == 'Both, Parent and Educator')
$userEmail['text'][] = 'This is a <b>Contact Type C</b>';

Where 'This is a Contact Type ...' is the body of message text.
I am missing something here.

I have reviewed the documentation at www.rsjoomla.com/support/documentation/v...p-email-scripts.html and it is not very clear as to what I am doing wrong.

Please help me!

Here is there response:

Hello Jack,

Normally RSJoomla! is not providing customization, but we try to help our customers in any way that we can. Please try using this script instead(Script called before the User Email is sent):
$modUserEmailText = $form->UserEmailText;
 
if($_POST['form']['Contact Type'] == 'Parent'){
$userEmail['text'] = 'This is a <b>Contact Type A</b>';
}
 
if($_POST['form']['Contact Type'] == 'Educator'){
$userEmail['text'] = 'This is a <b>Contact Type B</b>';
}
 
if($_POST['form']['Contact Type'] == 'Both, Parent and Educator'){
$userEmail['text'] = 'This is a <b>Contact Type C</b>';
}
 
$modUserEmailText = str_replace($placeholders, $values, $userEmail['text']);
$userEmail['text'] = $modUserEmailText;
$userEmail['text'] = str_replace($placeholders, $values, $userEmail['text']);

Regards!

This worked perfectly! I would like to thank the rsJoomla team for their help!!!!
Last Edit: 12 years 1 month ago by jkammert. Reason: SOLVED
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!