• 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: php mail script for multiple selection

php mail script for multiple selection 11 years 11 months ago #23364

I need use this script for multiple selection:

if($_POST[0] == 'option1')
$userEmail = ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';
if($_POST[0] == 'option2)
$userEmail = ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';
if($_POST[0] == 'option3')
$userEmail = ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';

When you select only one option it works fine but not for multiple selection. I need it works if you select per ex: option1+option2 or 1+2+3.....

what is wrong in the code???? Please help
The administrator has disabled public write access.

php mail script for multiple selection 11 years 11 months ago #23368

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
The correct syntax is
$_POST['form']['field-name'][0]

you'll need to replace field-name with your actual field name. Don't replace 'form' with anything. For example, if you have a dropdown named "Contact", you'll have to use:
$_POST['form']['Contact'][0]
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

php mail script for multiple selection 11 years 11 months ago #23375

sorry, the correct code I'm using is:

if($_POST[0] == 'option1')
$userEmail = ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';
if($_POST[0] == 'option2)
$userEmail = ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';
if($_POST[0] == 'option3')
$userEmail = ' This e-mail address is being protected from spambots. You need JavaScript enabled to view it ';

with this code only works with a unique selection but I need multiple selection, per ex: option1+option2 or 1+2+3.....
The administrator has disabled public write access.

php mail script for multiple selection 11 years 11 months ago #23376

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
The code is still not correct.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

php mail script for multiple selection 11 years 11 months ago #23378

when I copy de code and save it is modificate.

this is correct:

if($_POST['form']['fiel-name'][0] == 'option1')
$userEmail = ' email01@domain.com';
if($_POST['form']['fiel-name'][0] == 'option2)
$userEmail = ' email02@domain.com';
if($_POST['form']['fiel-name'][0] == 'option3')
$userEmail = ' email03@domain.com';

with this code only works with a unique selection but I need multiple selection, per ex: option1+option2 or 1+2+3.....
Last Edit: 11 years 11 months ago by gustavo.vazquez.
The administrator has disabled public write access.

php mail script for multiple selection 11 years 11 months ago #23386

when I copy de code and save it is modificate.

this is correct:

if($_POST['form']['fiel-name'][0] == 'option1')
$userEmail = ' email01@domain.com';
if($_POST['form']['fiel-name'][0] == 'option2)
$userEmail = ' email02@domain.com';
if($_POST['form']['fiel-name'][0] == 'option3')
$userEmail = ' email03@domain.com';

with this code only works with a unique selection but I need multiple selection, per ex: option1+option2 or 1+2+3.....
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!