setQuery($query);$options = $db->loadAssocList();$form->data['email_to_use'] = $optionsI then use the email_to_use field in the dynamic email to field in the email action. Particularly worried about trying to put member no in sql string."> Send email but hide address - Forums

Forums

Send email but hide address

misterg2 14 Jul, 2012
I have member of our society who wish to communicate with one another. To avoid publishing email addresses our list identifies them by member number. I have a table with member number and email address. I would like to display a form that lets them input member number and a message. I then would like to send the message to the email corresponding to the member number.
I have set up a form and displayed the html on form load. On submit I want to access the db and send an email. I have tried to use the db loader and then custom code. Both have not work - keep getting - you must supply at least one email address. I have looked at several examples. Here is the custom code - not a php person so it may be incorrect.
$db =& JFactory::getDBO();
$query = "
SELECT `email`
FROM `xnwi_membersemail`
WHERE `Member_No` = " & $form->data[Member_No] & " ;";
$db->setQuery($query);
$options = $db->loadAssocList();
$form->data['email_to_use'] = $options
I then use the email_to_use field in the dynamic email to field in the email action. Particularly worried about trying to put member no in sql string.
misterg2 15 Jul, 2012
I have achieved this using the DB Record Loader. As a newbie I had not realised one can simply put the index field in the param entry for the event and save in a hidden field in the form. Also the field names are case sensitive !
GreyHead 15 Jul, 2012
Hi misterg2,

Well done. I'm still finding new ways of doing things after a few years of using ChronoForms.

Bob
This topic is locked and no more replies can be posted.