WordPress PHP command and ELSE IF problem

It could work like this; but you need to use get_field() instead of the_field(), since the latter displays the field instead of returning a value.
See https://www.advancedcustomfields.com/resources/the_field/ for more information.

tech