Autoresponder with form fields that are empty

Issues related to forms.
Post Reply
John_Pittman
 
 
Posts: 10
Joined: Tue Jan 18, 2022 5:38 pm

Autoresponder with form fields that are empty

Post 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
User avatar
Pablo
 
Posts: 22489
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Autoresponder with form fields that are empty

Post 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.
John_Pittman
 
 
Posts: 10
Joined: Tue Jan 18, 2022 5:38 pm

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

Post by John_Pittman »

Thanks anyway,

John Pittman
John_Pittman
 
 
Posts: 10
Joined: Tue Jan 18, 2022 5:38 pm

Re: Autoresponder with form fields that are empty

Post 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
Post Reply