SOLVED: Assigning multiple hidden emails.

cb1 22 Jan, 2011
Hey,
I have tried, using FAQ 31, to send an inquiry to multiple hidden emails.

Store 1 Inquiry goes to [email]email1@domain.com[/email], [email]email2@domain.com[/email], [email]email3@domain.com[/email], etc

Store 2 Inquiry goes to [email]email1@domain.com[/email], email4@domain.com, email5@domain.com, etc

The actual emails have been changes for the sake of this post.

My OnSubmit code looks like this:

<?php
$recipient = JRequest::getString('recipients', '', 'post');
$emails = array (
'em1' => 'email1@domain.com','email2@domain.com','email3@domain.com','email4@domain.com',
'em2' => 'email1@domain.com','email5@domain.com','email6@domain.com','email4@domain.com',
'em3' => 'email1@domain.com','email7@domain.com','email8@domain.com','email4@domain.com',
);
$email_to_use = $emails[$recipient];
JRequest::setVar('email_to_use', $email_to_use);
?>


The associated HTML code looks like this:

<select name="recipients">
  <option value="em1">Store 1</option>
  <option value="em2">Store 2</option>
 <option value="em3">Store 3</option>
</select>


Is this the proper way to execute this? It doesn't seem to be working. So I guess it isn't.

Any help is appreciated.
cb1 22 Jan, 2011
I have revised my onSubmit code to this:
<?php
$recipient = JRequest::getString('recipients', '', 'post');
$emails = array (
'em1' => array('email1@domain.com','email2@domain.com','email3@domain.com','email4@domain.com'),
'em2' => array('email1@domain.com','email5@domain.com',email6@domain.com','email4@domain.com'),
'em3' => array('email1@domain.com','email7@domain.com','email8@domain.com','email4@domain.com'),
);
$email_to_use = $emails[$recipient];
JRequest::setVar('email_to_use', $email_to_use);
?>


But it is still not working. Thoughts?
Max_admin 24 Jan, 2011
Hi,

You have a missing single quote in the em2 array.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cb1 24 Jan, 2011
Thanks Max - I got it. I was missing elements in my email set up also. Chased them all down.

Thanks again!
This topic is locked and no more replies can be posted.