If statement in HTML


#1

I am trying to use an "if" statement to conditionally pass information from a form field to an email sent after submission of form.
if ({pairs1_a} !=") : {pairs1_a} endif;
The objective here is: -
* if the field is "filled" then pass the value of the field (usually a name) to the email.
* if the field is not "filled" i.e. blank then display in the email a blank space (or "Nil")

The if statement is passing the filled value to the email Ok but when "not filled" it displays the field name i.e. {pairs1_a}
Can anyone help with this please.


#2

HTML doesn't have an IF statement. PHP and other server-side languages do, or are you using a templating system?


#3

I have a licenced form builder which I am very happy with. I purchased a standard email template with it and I don't like the email appearance so I am working on it. The author doesn't provide development support but it is open source and I am told I can do whatever I want with it.
I have achieved a great deal in my goal by extending and recoding what I have to work with. I have come to a halt at this point.
You are no doubt technically correct in that the if statement is not html; however my research says that the if statement can be used and I am seeking assistance in that regard.
Thank you for your reply.


#4

as @gandalf458 says there is no IF statement in plain HTML. So if it is possible on the system you are using it will be using a serverside technology.

Can you see any files with .php at the end instead of .html? (or maybe .asp, .jsp or .cfm).

If you can't see any you could try and create a page called info.php and inside that put

<?php echo phpinfo(); ?>

Upload that to your server and see if it loads in a browser. If it does you are running PHP. Once you have tested delete that file off your server.

hth


#5

The code doesn't look like PHP, so without details of the template you're using people can only guess at an answer.


#6

Show us the URLs or book titles to your body of "research" so we will know what you are using and how it is supposed to work. Otherwise, we're kinda stuck, too... technically.


#7

Hi guys, not ignoring you but I am in Oz and there is probably a big time difference with most. I am now having discussion with freelancer who previously has worked on custom email templates for the same form builder. I will see how I go and then come back to this topic. Cheers (I hope)


closed #8

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.