Using Databasejoin plugin with email form plugin problem

aaronpie

New Member
I want to be able to email a form to an email address based on a selection of a dropdown. I have a separate table called "fab_pm_emails" with an id, pm_name, and pm_email where I store all the project manager's email addresses. I am using a database join dropdown (full element name: fab_accident_rpt___my_pm) in the main form with label set to pm_name and the value is set to the id. I found some php code in the forums that I am using with the form email plugin in the email eval field, but for some reason it is not emailing the completed form to the selected project manager. Any suggestions? I am using the latest version of Fabrik on Joomla 2.5.

Code:

$my_email_to = '';$contact_id = (int)$formModel->getElementData('fab_accident_rpt___my_pm', true, 0);
if (!empty(
$contact_id)) {
$myDb = $formModel->getListModel()->getDb();
$query = $myDb->getQuery(true);
$query->select('pm_email')->from('fab_pm_emails')->where('id = ' . $myDb->Quote($contact_id));
$myDb->setQuery($query);
$email_to = $myDb->loadResult();
}
return
$my_email_to;
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top