Im trying to build a form that emails the form submission to a different person based on a selection list.
For example, the question reads:
I would like more information on:
- Real Estate
- Membership
- Choice 3
- Choice 4
If someone chooses option 1, a copy of the form is emailed to department 1, if option 2, a copy goes to department #2, etc.
Is something like this possible? Any help would be greatly apreciated.
Thanks🙂
For example, the question reads:
I would like more information on:
- Real Estate
- Membership
- Choice 3
- Choice 4
If someone chooses option 1, a copy of the form is emailed to department 1, if option 2, a copy goes to department #2, etc.
Is something like this possible? Any help would be greatly apreciated.
Thanks🙂
Possible, in the onsubmit before email :
and so...
Cheers
Max
<?php
if($_POST['real_estate_field']){
$rows[0]->extraemail .= "rea_estate@yourdomain.com";
}
?>
and so...
Cheers
Max
Thank you for your prompt reply! However it's not working =/
I tried the above code and modded it to this to fit the value name:
Also the page in question can be found here:
http://goldenocala.coalescecreative.com/index.php/component/chronocontact/?chronoformname=contact_form
Also here is the bit of the form that's pertinate:
I tried the above code and modded it to this to fit the value name:
<?php
if($_POST['real_estate']){
$rows[0]->extraemail .= "email@domain.com";
}
?>
Also the page in question can be found here:
http://goldenocala.coalescecreative.com/index.php/component/chronocontact/?chronoformname=contact_form
Also here is the bit of the form that's pertinate:
<select name="more_info" size="4" multiple id="more_info">
<option value="real_estate">Real Estate</option>
<option value="membership">Membership</option>
<option value="banquet">Banquet/Catering</option>
<option value="employment">Employment</option>
</select>
Hi, sorry my mistake, make this line like this :
cheers
Max
$rows[0]->extraemail .= ",rea_estate@yourdomain.com";
cheers
Max
Max, thank you again for your reply. Still no dice on the extra E-mails coming in. The primary E-mail is receiving everything fine, just not the ones in here:
<?php
if($_POST['membership']){
$rows[0]->extraemail .= ",email@domain.com";
}
?>
Any other ideas? Thank you
<?php
if($_POST['membership']){
$rows[0]->extraemail .= ",email@domain.com";
}
?>
Any other ideas? Thank you
Hi mancourt,
I'd add a line of diagnostic code in there:
Bob
I'd add a line of diagnostic code in there:
<?php
if ( $debug ) {
echo "extraemail: "; print_r($rows[0]->extraemail);echo "<br />";
}
if ( $_POST['membership'] ) {
$rows[0]->extraemail .= ",email@domain.com";
if ( $debug ) {
echo "extraemail: "; print_r($rows[0]->extraemail);echo "<br />";
}
}
?>
when debug is on this should print out a line showing you what's in 'extraemail' before and after the change.
Bob
Bob, thanks again for your reply.
Here is what the debug code popped out:
For some reason the extraemail field is just using whatever the default E-mail I setup, not the one I put in the PHP onsubmit field. It's as if the PHP onsubmit code isn't overriding the default E-mail address for the form.?
Here is what the debug code popped out:
_POST: Array ( [action] => submit [first_name] => NAME [last_name] => LAST NAME [street] => STREET ADDRESS [city] => Port Orange [state] => Florida [zip] => 32127 [phone_daytime] => [phone_evening] => [fax] => [email] => [email]justin@mydomain.com[/email] [contact_preference] => E-mail Address [more_info] => membership [comments] => testing [button] => Submit )
Case 1: Use table layout
extraemail: [email]mainemail@domain.com[/email]
E-mail: 'Yes' custom
Email sent
For some reason the extraemail field is just using whatever the default E-mail I setup, not the one I put in the PHP onsubmit field. It's as if the PHP onsubmit code isn't overriding the default E-mail address for the form.?
Hi mancourt,
The PHP check is checking
The PHP check is checking
if ( $_POST['membership'] ) {
but there's no 'membership' field there. I think it should be:Code:
<?php
if ( $debug ) {
echo "extraemail: "; print_r($rows[0]->extraemail);echo "<br />";
}
if ( $_POST['more_info'] == 'membership' ) {
$rows[0]->extraemail .= ",email@domain.com";
if ( $debug ) {
echo "extraemail: "; print_r($rows[0]->extraemail);echo "<br />";
}
}
?>
Bob
Bob, wanted to follow up. Is it possible to get the code above to work with a checkbox scenario so it's easier for users to make multiple selections?
Hi mancourt,
Yes. Collect the checkbox replies in an array and then run through the array and add an email address for each entry in there.
Bob
Yes. Collect the checkbox replies in an array and then run through the array and add an email address for each entry in there.
Bob
Bob, you've already helped me out enough on this one, but could someone help me on building an "array" to make this possible?
This topic is locked and no more replies can be posted.