Support

Account

Home Forums ACF PRO Getting array with selected values only

Solved

Getting array with selected values only

  • Hello,
    I tried to get an array from select field
    This select field consists of cites to select (multi select with ajax enabled )
    this code below was test which gets all fields. But i need an array with just the selected cities.

    $field_key = "field_5a18ee424e883";
    $field = get_field_object($field_key);
    
    if( $field )
    {
    	echo '<select name="' . $field['key'] . '">';
    		foreach( $field['choices'] as $k => $v )
    		{
    			echo '<option value="' . $k . '">' . $v . '</option>';
    		}
    	echo '</select>';
    }

    Thank You

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Getting array with selected values only’ is closed to new replies.