How to use echo get_post_meta() in if/else statement
-
Hello.
I am trying to figure out an if/else statement for the following scenario:
echo get_post_meta($postid, ‘Alabama’, true) {
echo “, Alabama”;
} else {
if (echo get_post_meta($postid, ‘Alaska’, true) {
echo “, Alaska”;Basically, a user is able to select State from a dropdown list. Then, an associated dropdown field, city, would be displayed for user to select a city for the state.
I created custom fields for Alabama and Alaska so that user can select associated city.
The output I’m trying to achieve is:
Location: Mobile, Alabama
after the user selects State and City.
My question is: can somebody kindly advise on how to integrate an If Else statement for the above php code? The Alabama php code outputs correctly. However, I can’t seem to figure out how to include other states and associated city for the user.
Hope that made sense. Greatly appreciated your assistance folks! https://www.ymphony.com
- The topic ‘How to use echo get_post_meta() in if/else statement’ is closed to new replies.