• 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: Change $adminEmail[to] Using php script

Change $adminEmail[to] Using php script 5 years 9 months ago #39295

Hello,
Sorry for my bad english.

In a dropdown in my form we can choose admin to contact like this :
user1@mail.com|User 1
user2@mail.com|User 2

But email adresses are visible in source code on website, and I don't want that.

So I tried this (www.rsjoomla.com/support/documentation/r...p-email-scripts.html)
if($_POST['form']['user'][0] == 'User 1')
      $userEmail['to'] = 'user1@mail.com';
 
if($_POST['form']['user'][0] == 'User 2')
      $userEmail['to'] = 'user2@mail.com';

But it doesn't work...

I check source code of my form and I found that :
<form method="post"  id="userForm"

So I change
if($_POST['form']['user'][0] == 'User 1')
for
if($_POST['userForm']['user'][0] == 'User 1')

But still don't work....

Someone can help me ?
The administrator has disabled public write access.

Change $adminEmail[to] Using php script 5 years 9 months ago #39300

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

The following is correct (whereas myFieldName has to be the exact name you've given to your field; case sensitive):
$_POST['form']['myFieldName']

If you're unsure what structure $_POST has, you can always view its contents by adding the following temporarily and by submitting the form once more:
print_r($_POST);die;

For a dropdown you would use:
$_POST['form']['myFieldName'][0]

Eventually you can specify this as follows; of course the field name and value has to be correctly added (try using curly brackets to prevent your IF statements from getting mixed):
if($_POST['form']['user'][0] == 'User 1'){
      $userEmail['to'] = 'user1@mail.com';
}
This is not official customer support. To receive your support, submit a support ticket here.
Last Edit: 5 years 9 months ago by adrianp. Reason: emphasizing
The administrator has disabled public write access.
The following user(s) said Thank You: tdconcepts

Change $adminEmail[to] Using php script 5 years 9 months ago #39304

I tried again, and it seems to be working now

Thank you for your help
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!