## Support

### Account

Home Forums Front-end Issues Logical condition between two fields + True / False

Solved

# Logical condition between two fields + True / False

• Hi everyone, I’m trying to implement a feature by combining the logical condition with the True / False field

Basically, I have three fields: Field A, Field B and Field C.

Field A and B are numeric fields while Field C is a True / False field

I would like when Field B has a value equal to or greater than Field A (backend), activate Field C and then show me the content (frontend)

Maybe I could solve Camp C with a logical condition combined with the other two (A – B) but I am on the high seas at the moment, I hope someone can help me.

• I don’t understand what the true/false field is for.

To show something if field b >= field a

``````
\$value_a = get_field('field_a');
\$value_b = get_field('field_b');
if (\$value_b >= \$value_a) {
// do something
}
``````
• Great John! It was just what I was looking for but only that my dynamic was much more confused.

I take this opportunity for a further question of this functionality.

Using the same condition but also adding Field C as the third variable

I’m trying this:

``````<?php
\$value_a = get_field('warning_limit');
\$value_b = get_field('closing_limit');
\$value_c = get_field('number_members');
if (\$value_c >= \$value_a) {
echo("Limited tickets");
}
elseif (\$value_c == \$value_b) {
echo("Tickets sold out");
} else {
echo("Tickets available");
}
?>``````

Except that the second part is not working at the moment, I certainly did something wrong

• ``````
if (\$value_c >= \$value_a && \$value_b < \$value_a) {
echo("Limited tickets");
} elseif (\$value_b >= \$value_a) {
echo("Tickets sold out");
} else {
echo("Tickets available");
}
``````
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Logical condition between two fields + True / False’ is closed to new replies.