I have another form (not in chronoforms) that uses an external php action to return only completed fields to the email.
So if it has
field1
field2
field3
field4
and the user only fills in field 1 & 2, only field 1 & 2 with the results will be emailed. There are, of course, many more fields, and it's annoying to see them all listed with only 1 or 2 "ON".
I have the form html working, and put the php in the "on submit" area, (before email) and it sends the result to me correctly (with only the fields showing that are filled in), but the copy that goes to the user has all fields.
Is there a better place or way to put that php action to get it to work for both emails? Or a better way to do this?
Thanks in advance. Cheryl
So if it has
field1
field2
field3
field4
and the user only fills in field 1 & 2, only field 1 & 2 with the results will be emailed. There are, of course, many more fields, and it's annoying to see them all listed with only 1 or 2 "ON".
I have the form html working, and put the php in the "on submit" area, (before email) and it sends the result to me correctly (with only the fields showing that are filled in), but the copy that goes to the user has all fields.
Is there a better place or way to put that php action to get it to work for both emails? Or a better way to do this?
Thanks in advance. Cheryl
Hi cheryl,
You can do this with conditional code in the email template field. Something like:
Bob
You can do this with conditional code in the email template field. Something like:
<?php
field_array = array('field1' => 'Field Name 1', 'field2' => 'Field Name 1', . . . );
foreach ( $field_array as $field => $fieldname ) {
if ( isset($_POST[$field]) ) {
echo "<tr><td>$fieldname</td><td>".$_POST[$field]."</td></tr>";
}
}
?>
Not tested - may well be buggyBob
This topic is locked and no more replies can be posted.