/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Email and Form help?

I am trying to setup a Form-To-Mail where a user selects a department and the email is directed towards that department. I would like to use one form for over 10 departments. The department could be chosen from a drop down menu and the email is sent ONLY to that department.

View the form I made at this link: [url]www.gc40.com/form.html[/url] to get an idea of what I mean.

Basically, I would like a user to come to ONE “Contact Us” page and they can choose the department they want from the drop down menu and the contact information changes for that department and the email address changes when it is submitted.

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@Wiz_CreationsAug 26.2006 — Try asking in the PHP forum.
Copy linkTweet thisAlerts:
@bajanboostauthorAug 26.2006 — I was able to get it to work...

Problem is, I understand from a friend that the method I am using makes my emails open to spam bots....Check the code I used...

I removed:
[code=html] <input type=hidden name=recipient value='[email protected]'>
[/code]


and replaced it with:

[code=html]
<select name="recipient" size="1">
<option value="[email protected]" selected>The Fund Manager</option>
<option value="[email protected]">Sales Team</option>
<option value="[email protected]">Investment Advisor</option>
<option value="[email protected]">Customer Service</option>
<option value="[email protected]">General Inquiries</option>
</select>
[/code]


Advise?
Copy linkTweet thisAlerts:
@pcthugAug 26.2006 — Well you may want to associate the e-mail address with PHP:
[code=html]
<select name="recipient" size="1">
<option value="[email protected]" selected>The Fund Manager</option>
<option value="[email protected]">Sales Team</option>
<option value="[email protected]">Investment Advisor</option>
<option value="[email protected]">Customer Service</option>
<option value="[email protected]">General Inquiries</option>
</select>[/code]

Becomes...
[code=html]
<select name="recipient" size="1">
<option value="a" selected>The Fund Manager</option>
<option value="b">Sales Team</option>
<option value="c">Investment Advisor</option>
<option value="d">Customer Service</option>
<option value="e">General Inquiries</option>
</select>[/code]

And then use the following PHP to [I]decode[/I] the passed post values:
[code=php]
$recipient = (empty($_POST['recipient'])) ? 'default' : $_POST['recipient'];
$email_addresses = array('a' => '[email protected]', 'b' => '[email protected]', 'c' => '[email protected]', 'd' => '[email protected]', 'e' => '[email protected]', 'default' => '[email protected]');

if(!array_key_exists($recipient, $email_addresses) {
$recipient = $email_addresses['default'];
}
else {
$recipient = $email_addresses[$recipient];
}[/code]
×

Success!

Help @bajanboost spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...