Embed if/else Statement Within Message Body
-
I am trying to embed an if/else statement for the automated html message that goes out after a user submits the cf7 form on my site.
What I am trying to accomplish is that if a user leaves the [first-name2] field empty the opening line of the message should say “Hey first name,” and if both fields are not null then it should say “Hey first name1 & first name2,”.
For some reason the condition is not working. I am assuming that it is not understanding what “[first-name2]” generated tag is.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> <html> <body> <?php if (empty([first-name2])) { ?> <h2><span style="color: #666666;">Hey [first-name1],</span></h2> <?php } else { ?> <h2><span style="color: #666666;">Hey [first-name1] & [first-name2],</span></h2> <?php } ?> </body> </html>
I would greatly appreciate any help.
Thank you!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Embed if/else Statement Within Message Body’ is closed to new replies.