This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
custom_hooks and multiple forms
Started 15 years ago by susanfw | 2 posts |
-
I will have a number of forms that will each have dropdown menus to choose who the forms gets mailed to. One of the form is working properly now using custom_hooks.php and editing helper-functions.php. Before I configure the next form with the dropdown, I wanted to find out whether I should add the additional code to the custom_hooks.php, or create a new custom_hooks2.php page for each form? The following is what I'm thinking it should look like if I add the code to custom_hooks.php.
<?php
function form4_hook_email($params){//change the email addresses below
$email_list[1] = 'xxx1@domain.com';
$email_list[2] = 'xxx2@domain.com';
$email_list[3] = 'xxx3@domain.com';
$email_list[4] = 'xxx4@domain.com';$res = do_query("select element_5 from ap_form_{$params['form_id']}
where id='{$params['entry_id']}'");
$row = do_fetch_result($res);$attn = $row['element_5'];
$target_email = $email_list[$attn];
if(!empty($target_email)){
return $target_email;
}else {
return true;
}
}function form14_hook_email($params){
//change the email addresses below
$email_list[1] = 'xxx5@domain.com';
$email_list[2] = 'xxx6@domain.com';
$email_list[3] = 'xxx7@domain.com';
$email_list[4] = 'xxx8@domain.com';$res = do_query("select element_3 from ap_form_{$params['form_id']}
where id='{$params['entry_id']}'");
$row = do_fetch_result($res);$attn = $row['element_3'];
$target_email = $email_list[$attn];
if(!empty($target_email)){
return $target_email;
}else {
return true;
}
}
?>Thank you.
SusanPosted 15 years ago # -
No need to create another custom_hooks2.php file. You can use the current custom_hooks.php and add as many code as needed there.
Your code above seems correct already.
MachForm Founder
Posted 15 years ago #
Reply
You must log in to post.