Hello,
we use a normal enfold avia form with a selection field. Now we want to use the selected value of the selectionfield for the subject for the emails which will be send.
I found this code here in another thread
add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
function avia_change_mail_subject($subject, $new_post, $form_params) {
$subject = 'e-mailform - ' . urldecode($new_post['5_1']);
return $subject;
}
But for this code i got a fatal error on the php side. Can you plz help us with this task?
thanks
Chris
Hey Chris_85,
Please give this a try:
add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
function avia_change_mail_subject($subject, $new_post, $form_params) {
$subject = sprintf("%s", $new_post['5_1']);
return $subject;
}
this assumes that the fifth field in the contact form is a select field:
note that any spaces in the field will be replaced with %20
so use an underline or dash
Best regards,
Mike