PDA

View Full Version : Different Receipients depending on selection


info273228
06-02-2009, 04:32 PM
Hi,

Does anyone know how to send a form to different email addresses depending on a selection in the FORM?
Radio button preferred..

I have both ValidationToolkit and Contact Form Solution Pack

Any idea greatly appreciated!

Ray Borduin
06-03-2009, 06:08 AM
Just add the radio buttons to the page and set their values to the email address you want to send it to. Then update the To field in the contact form solution pack global if you are using the contact form solution, or update it directly in the Email Server behavior To field if you are using Universal Email alone or would prefer to not use a global.

You can use the bindings to see how to reference the radio button value from the form in the code.

info273228
06-04-2009, 03:08 PM
let me see if I get this right..

The code in the form:
<input type="radio" name="England" value="email@emailaddress.uk" id="England" />
<input type="radio" name="Australia" value="email@emailaddress.au" id="Australia" />

however, the Code in WAGLOBAL? what do I put in there?
$WAGLOBAL_Email_To = "??" ;

Consider me a non-programmer :)

Ray Borduin
06-04-2009, 03:13 PM
Nope...

The code in the form:
<input type="radio" name="CountryEmail" value="email@emailaddress.uk" id="England" checked />
<input type="radio" name="CountryEmail" value="email@emailaddress.au" id="Australia" />

the Code in WAGLOBAL:
$WAGLOBAL_Email_To = $_POST['CountryEmail'] ;

info273228
06-05-2009, 04:27 PM
Thanks Ray..

You are a life saver... much appreciated!

info273228
06-05-2009, 08:05 PM
Hi, Ray..

The code works great, one small thing thou!

The resulting email shows the following:
CountryEmail: info@emailaddress.uk

But since some of the countries go to the same email address, I am not capturing the selection they have made.. in this case what country their passport is from..
Without adding a field to the form, is there anyway I can pick up the 'ID' from the form field?

<input type="radio" name="CountryEmail" value="info@vikingbear.com" id="Argentina" />
Argentina<br>
<input type="radio" name="CountryEmail" value="ken@kangarootrails.com.au" id="Australia" />Australia<br />
<input type="radio" name="CountryEmail" value="info@vikingbear.com" id="Belgium" />
Belgium<br>

Any Idea is greatly appreciated!

Ray Borduin
06-08-2009, 06:06 AM
Not really... only one value is submitted, so you can't both use the email and another more unique attribute... it just doesn't work that way.

You might try adding a couple of spaces before or after the email address so that it is unique. Having spaces may not throw off the email and will allow the values to be differentiated.

info273228
06-09-2009, 06:32 PM
Hi, Ray

Thanks again for your time looking into this, I think what I might do then is to set up an email address for each, ie. norway@blah.com and FORWARD the email in my Cpanel to the 'normal' email address, this way it will be clear what country was ticked.. long way around but any solution is a good solution :)

Another tricky one for you!
Is there a way to determine the order each field is listed in the resulting email? and even exclude fields like 'submit' there is no reason for that one to show..

Ray Borduin
06-10-2009, 06:17 AM
You can edit the email body to create a specific order.

The easy way to keep form elements from showing is to name them... anything that begins with the name: "Security_" will not be included.

So you can name your form button: name="Security_submit" and it won't be included in the email.