<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: custom_hooks and multiple forms</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: custom_hooks and multiple forms</description>
<language>en</language>
<pubDate>Mon, 04 May 2026 02:05:59 +0000</pubDate>

<item>
<title>yuniar on "custom_hooks and multiple forms"</title>
<link>https://www.machform.com/forums/topic/custom_hooks-and-multiple-forms#post-7521</link>
<pubDate>Thu, 01 Oct 2009 11:29:28 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">7521@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;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.&#60;/p&#62;
&#60;p&#62;Your code above seems correct already.
&#60;/p&#62;</description>
</item>
<item>
<title>susanfw on "custom_hooks and multiple forms"</title>
<link>https://www.machform.com/forums/topic/custom_hooks-and-multiple-forms#post-7504</link>
<pubDate>Wed, 30 Sep 2009 22:27:35 +0000</pubDate>
<dc:creator>susanfw</dc:creator>
<guid isPermaLink="false">7504@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;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.&#60;/p&#62;
&#60;p&#62;&#38;lt;?php&#60;br /&#62;
function form4_hook_email($params){&#60;/p&#62;
&#60;p&#62;	//change the email addresses below&#60;br /&#62;
	$email_list[1] = 'xxx1@domain.com';&#60;br /&#62;
	$email_list[2] = 'xxx2@domain.com';&#60;br /&#62;
	$email_list[3] = 'xxx3@domain.com';&#60;br /&#62;
	$email_list[4] = 'xxx4@domain.com'; &#60;/p&#62;
&#60;p&#62;	$res = do_query(&#34;select element_5 from ap_form_{$params['form_id']}&#60;br /&#62;
where id='{$params['entry_id']}'&#34;);&#60;br /&#62;
	$row = do_fetch_result($res);&#60;/p&#62;
&#60;p&#62;	$attn = $row['element_5'];&#60;/p&#62;
&#60;p&#62;	$target_email = $email_list[$attn];&#60;/p&#62;
&#60;p&#62;	if(!empty($target_email)){&#60;br /&#62;
		return $target_email;&#60;br /&#62;
	}else {&#60;br /&#62;
		return true;&#60;br /&#62;
	}&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;function form14_hook_email($params){&#60;/p&#62;
&#60;p&#62;	//change the email addresses below&#60;br /&#62;
	$email_list[1] = 'xxx5@domain.com';&#60;br /&#62;
	$email_list[2] = 'xxx6@domain.com';&#60;br /&#62;
	$email_list[3] = 'xxx7@domain.com';&#60;br /&#62;
	$email_list[4] = 'xxx8@domain.com'; &#60;/p&#62;
&#60;p&#62;	$res = do_query(&#34;select element_3 from ap_form_{$params['form_id']}&#60;br /&#62;
where id='{$params['entry_id']}'&#34;);&#60;br /&#62;
	$row = do_fetch_result($res);&#60;/p&#62;
&#60;p&#62;	$attn = $row['element_3'];&#60;/p&#62;
&#60;p&#62;	$target_email = $email_list[$attn];&#60;/p&#62;
&#60;p&#62;	if(!empty($target_email)){&#60;br /&#62;
		return $target_email;&#60;br /&#62;
	}else {&#60;br /&#62;
		return true;&#60;br /&#62;
	}&#60;br /&#62;
}&#60;br /&#62;
?&#38;gt;&#60;/p&#62;
&#60;p&#62;Thank you.&#60;br /&#62;
Susan
&#60;/p&#62;</description>
</item>

</channel>
</rss>
