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🙂
<?php
if($_POST['real_estate_field']){
$rows[0]->extraemail .= "rea_estate@yourdomain.com";
}
?>
and so...
Cheers
Max
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>
$rows[0]->extraemail .= ",rea_estate@yourdomain.com";
cheers
Max
<?php
if($_POST['membership']){
$rows[0]->extraemail .= ",email@domain.com";
}
?>
Any other ideas? Thank you
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
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.?
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
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
