Page 1 of 1

Autoresponder with form fields that are empty

Posted: Tue Feb 08, 2022 8:57 pm
by John_Pittman
Hi,
I have a form that is working correctly, It submits the data to db and sends site owner email with data and sends the auto responder to the email address in the form, all great no problem.
But I wanted a personalized auto responder message so I went to "rich text" for body and then add the variable names to the message body like first name etc.
And it all works,, but the problem ....... when a form variable is "empty" then in the email received by the person the body text shows the variable by name any place there is an empty variable.

example==================================
Hi, John
I see you are interested in Dallas ,$interest2 and .....................
==========================================
Where $fname = "John" and $interst1 = "Dallas" and $interest2 =""

Is there a way to suppress the the empty $var

Thanks the old new guy
JohnPittman

Re: Autoresponder with form fields that are empty

Posted: Tue Feb 08, 2022 9:04 pm
by Pablo
Sorry. there is no way to prevent this, because if the value is not in the $POST array then the script has no way to know that it needs to be replaced in the text.

==CLOSED==Re: Autoresponder with form fields that are empty

Posted: Tue Feb 08, 2022 9:51 pm
by John_Pittman
Thanks anyway,

John Pittman

Re: Autoresponder with form fields that are empty

Posted: Wed Feb 09, 2022 6:20 pm
by John_Pittman
FYI,
I figured out a way to get what I needed to work.
The problem was a not required selection list on the for saved as group[].
I just add another selection of "none" with a value of " " and default of selected
That way if the user did not make a selection my auto responder message would just have the variable replaced with a " ".
Works good for me now without needing to muck around in the page or form php code.

John Pittman