Developer Support »

Selecting email address depending on form input  (See more user questions)

Hello again

I have coded a version of the script that will do as you desire. I have
attached it to this email for you.

Enter a recipient email address in $my_email as normal. For every form
submission, one email will go to the $my_email address. This allows the
recipient to know that a visitor has submitted the form.

You will need to add the email addresses for the services. Locate this
chunk of code in the script:

"Consultants and Planners" =>
array('user@example.com','user@example.com','user@example.com'),
"Officiants" =>
array('user@example.com','user@example.com','user@example.com'),
"Venues and Receptions" =>
array('user@example.com','user@example.com','user@example.com'),
"Rehearsal Dinners" =>
array('user@example.com','user@example.com','user@example.com'),
"Caterers" =>
array('user@example.com','user@example.com','user@example.com'),
"Photographers" =>
array('user@example.com','user@example.com','user@example.com'),
"Videographers" =>
array('user@example.com','user@example.com','user@example.com'),
"Cakes and Bakers" =>
array('user@example.com','user@example.com','user@example.com'),
"Florists" =>
array('user@example.com','user@example.com','user@example.com'),
"Wedding Attire and Jewelry" =>
array('user@example.com','user@example.com','user@example.com'),
"Musicians" =>
array('user@example.com','user@example.com','user@example.com'),
"Hair Makeup and Spas" =>
array('user@example.com','user@example.com','user@example.com'),
"Disc Jockeys" =>
array('user@example.com','user@example.com','user@example.com'),
"Wedding Accessories and Gifts" =>
array('user@example.com','user@example.com','user@example.com'),
"Places to Stay" =>
array('user@example.com','user@example.com','user@example.com'),
"Things to Do" =>
array('user@example.com','user@example.com','user@example.com'),
"Bridal Magazines and Websites" =>
array('user@example.com','user@example.com','user@example.com'),
"Transportation" =>
array('user@example.com','user@example.com','user@example.com'),
"Rentals and Decor" =>
array('user@example.com','user@example.com','user@example.com')

As you can see, I have put example email addresses in there. Put the
correct email addresses in the appropriate array. You can see, for every
category on the form, there is an array for the email addresses of the
recipients in that category.

IMPORTANT: Use the same format as above. Put the addresses in quotes and
separate them with a comma. You can have any number of addresses in each
array.

If you only have one address for a category, use this format:

array('user@example.com')

Some points:
**********

Change the action of the form, from this:

<form method="POST" action="http:///request.php">

to this:

<form method="POST" action="formtoemailpro.php">

(this assumes you have put the script in the same directory/folder as the
form page)

Change the email input on the form, from:

<input type="text" name="emailaddress" size=30 style="color: #33066;
font-family:

Verdana; font-weight: bold; font-size: 11px; background-color: #FFFFFF;">

to:

<input type="text" name="email" size=30 style="color: #33066; font-family:

Verdana; font-weight: bold; font-size: 11px; background-color: #FFFFFF;">

The form states this:

"To begin the SWPA has 17 categories of wedding professionals (see below)"

There are actually 19 categories.

Again on the form, the "Transportation" checkbox has "14" for a value.
Change it to "Transportation" (the Transportation emails won't send
otherwise).

Change the "hair" category value from this:

value="Hair, Makeup and Spas"

to this:

value="Hair Makeup and Spas"

( the comma will give an error with the new code and the emails won't send)

If the script is sending a lot of emails, you will notice a delay while it
is sending them. The script will only send emails in the category lists if
the appropriate checkbox is checked. In other words, for initial test
purposes you can submit a form without cheking any boxes. You can then add
test email addresses in the categories then check the boxes to see if you
get the emails.

The names used in the code ("Wedding Accessories and Gifts" etc etc) must
EXACTLY match the names on the form. I have copied them directly from your
form, so you don't need to change the names in the script but you do need to
change the transportation and hair values on the form (as mentioned above).

Give it a bash. Any questions, just let me know.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Wednesday, March 04, 2009 3:03 PM
Subject: Re: FormToEmail script


> Hi Charles,
> Wow! I'm struck by helpful you are! Thank you! I'm going to buy a license
> of your script for that reason only, if nothing else.
>
> To answer your questions:
>
>> So if you have 10 photographer email addresses and 5 bakers and the
>> visitor selects these, then you would want 15 emails sent in total, 10
>> to the photographers and 5 to the bakers?
>
>
> Yes, that's exactly correct!
>
>> Would all recipients get the exact same email?
>
>
> Yes. The contents of the form could remain exactly the same for all
> addresses. Just whatever the user had filled in to the form.
>
>> Either way, the script will have to know the email addresses to send to,
>> so you would have to hard-code ALL the email addresses into the script,
>> even if there's 100 or more!
>
>
> No problem! If you could get me started with some sort of "insert new
> email address here" comment in the code, I'm just savvy enough to where I
> could hand-code all of the additional email addresses myself with little
> trouble.
>
>> In addition to sending an email to the selected recipients, would you
>> also want a copy email to go to a certain address to indicate that a
>> visitor has submitted the form? In which case, just one email would be
>> sent to that address per form submission.
>
> Yes, that would be nice, but it's not critical.
>
> Again, Charles, I just can't believe how helpful you are. It is really
> refreshing. If the above would take a great deal of coding and you were
> willing to do it, I'd like to pay your for it. How much would you charge?
>
> Thanks again!
>
>
> On Mar 2, 2009, at 5:10 PM, FormToEmail.com wrote:
>
>> Hi
>>
>> Thank you for your question.
>>
>> You can modify the scipt to send to certain email addresses depending
>> on user selection. See this page on my support section:
>>
>> https://formtoemail.com/developersupport/select_form_recipient.php
>>
>> The above link gives you the idea, but it doesn't directly address your
>> issue because you are using checkboxes and you might have more than one
>> email address per category.
>>
>> I could possibly help you out with this. Can you tell me...is there
>> only one email address per category or are there potentially any number
>> of email addresses per category? Reading your form, I suspect it's the
>> latter.
>>
>> So if you have 10 photographer email addresses and 5 bakers and the
>> visitor selects these, then you would want 15 emails sent in total, 10
>> to the photographers and 5 to the bakers?
>>
>> Either way, the script will have to know the email addresses to send to,
>> so you would have to hard-code ALL the email addresses into the script,
>> even if there's 100 or more!
>>
>> Would all recipients get the exact same email?
>>
>> In addition to sending an email to the selected recipients, would you
>> also want a copy email to go to a certain address to indicate that a
>> visitor has submitted the form? In which case, just one email would be
>> sent to that address per form submission.
>>
>> It would all require some coding. Clarify the above points and I'll see
>> what I can do.
>>
>> Best wishes.
>>
>> Charles Sweeney
>> https://formtoemail.com
>> The world's easiest feedback script!
>>
>> ----- Original Message -----
>> Sent: Monday, March 02, 2009 8:19 PM
>> Subject: FormToEmail script
>>
>>
>>> Comments: Hi, I'm thinking about buying the Pro version of your script
>>> to process this form: http://www..com/request_info.html
>>>
>>> Quick question, can the pro version of your script be easily modified
>>> to send to certain email addresses depending on what option the user
>>> clicks in Step 1 on the site above? So if they click on Disc Jockeys
>>> and Caterers, the email would only be sent to those email addresses for
>>> caterers and dj's? Thanks! If you couldn't tell, I'm not too hot at
>>> programming.