Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:15:26+00:00 2026-06-01T11:15:26+00:00

How can I get a list of all the selected values ​​for a field?

  • 0

How can I get a list of all the selected values ​​for a field?

For example I have a field called countries, and I want to get all countries selected for a certain node.

I need to have this list, because I want the region to be automatically selected in another field (regions), according to the chosen country.

Ex: I choose France in the countries, then automatically the European region is selected in regions

For now I can only copy the selected values ​​in the “countries” field, in the “regions” field, by doing this:

$node->field_regions = $node->field_countries;

Here is the result when I select France in the countries field :

Country: France

Regions: France

Edit:
I tried with the function:field_get_items(), but all I get is an array:

$items = field_get_items('node', $node, 'field_countries', $node->language);

Something is wrong? I also tried with this but I get the same result…

$items = $node->field_countries[$node->language][0]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:15:27+00:00Added an answer on June 1, 2026 at 11:15 am

    Thanks to another forum, I managed to solve my problem.

    Here’s how to read the content of my field countries:

    foreach ($node->field_countries[$node->language] as $item) { 
        // Country id in Countries vocabulary
        $countryId = $item['tid'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app from where I can get the list of all installed
How can i get a list of all changes from TFS that were in
How can I to get list of all wcf services running on a machine?
How can I get a list of all the MySQL databases that exist on
Possible Duplicate: How can I get a list of all the defined variables in
In My wordpress blog I can get all the archive list in monthly view.
I tried to recursively get all files and folder list.But I can only get
I have a list box, filled with countries. A user can select multiple countries
I'm trying to get a list of objects based on 'un-selected' values in a
Can we get list of output cached URLs in IIS7? I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.