Support

Account

Home Forums Front-end Issues Get just the values from a multi-select drop down.

Solved

Get just the values from a multi-select drop down.

  • Hello, I’ve been having trouble figuring this out

    I have a multi-select drop down with values and labels.

    I need to get only the values (not the labels) for a particular part of my page. With everything I have tried I either only get “array array” or I get the first value and label, but not the subsequent. I don’t even want the labels, just the values.

    Any ideas or examples I could look to?

  • Also, I should mention, in some cases I am getting an “illegal offset type” error. Its almost like I have arrarys within an array that I am not properly accessing. I am not a PHP expert.

  • Actually turns out I was overthinking it.

    
    $values = get_field('company_category');
    foreach ($values as $value) {
    echo $value['value'];
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Get just the values from a multi-select drop down.’ is closed to new replies.