Title: Conditional Statements and Multiple Select
Last modified: December 6, 2016

---

# Conditional Statements and Multiple Select

 *  Resolved [dawnrae](https://wordpress.org/support/users/dawnrae/)
 * (@dawnrae)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/conditional-statements-and-multiple-select/)
 * I am a bit confused on applying conditional statements between values of two 
   Select field (single option).
 * The fields optional ones. They might both have values or only one may, and sometimes
   neither will have a value and I wish to apply a text field value instead.
 * Here are the fields
 *     ```
       $select_1 = $cfs->get('select_1', $post_id);
       $select_2 = $cfs->get('select_2', $post_id);
       $text_field = $cfs->get('text_field', $post_id);
       ```
   
 * I wish to check the fields and designate the output based on a “true/false” or
   presence of a value, and set an order in which they should be checked:
 * Here’s an example :
 *     ```
       if($select_1==true) { echo foreach($select_1 as $value => $label) { echo $value; } }
       elseif($select_2==true) { echo foreach($select_2 as $value => $label) { echo $value; } }
       else { echo $text_field; }
       ```
   
 * NOTE: I’ve tried this code with and without using “echo”
 * If select_1 should have a value, I’d like it to ignore the other options.
    If
   select_1 doesn’t have a value, I’d like it to check select_2 for a value. If 
   select_1 and select_2 don’t have a value, I’d like to display the text_field 
   value.
 * Right now, I can get it to check a single value and render properly, but when
   I attempt to apply the if/else in regards to the secondary select field, it will
   only retrieve one.
 * Do you have have any suggestions on how to get this to work the way I need?
 * Thank you
    -  This topic was modified 9 years, 6 months ago by [dawnrae](https://wordpress.org/support/users/dawnrae/).

The topic ‘Conditional Statements and Multiple Select’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-field-suite.svg)
 * [Custom Field Suite](https://wordpress.org/plugins/custom-field-suite/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-suite/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-suite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-suite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-suite/reviews/)

## Tags

 * [conditional statement](https://wordpress.org/support/topic-tag/conditional-statement/)

 * 0 replies
 * 1 participant
 * Last reply from: [dawnrae](https://wordpress.org/support/users/dawnrae/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/conditional-statements-and-multiple-select/)
 * Status: resolved