Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I created a form on my Drupal 6 site where users have the option to choose multiple topics from a checkbox list. Here is what I am doing to try and output those values:

$i = 0;
foreach ($node->field_topics as $key => $value) {
    echo "$key => $value<br />";
    $i++;
}

This outputs to (if the user were to choose 3 topics):

0 => Array
1 => Array
2 => Array

How do I get the actual value in the array and not just the word "array?"

I tried this:

$node->field_topics['value'] or $node->field_topics['#value'];

and it says invalid argument.

Thanks for any help on this.

share|improve this question
2  
You should use the dpm($node) to see the structure of data first and after that you can use the correct way to get the information from the $node. Be sure that you enable Devel module for supporting the dpm() function. – Stone Vo Apr 3 at 17:48
This is a too localized question. The content of $node->field_topics depends from the type of the node field. Apart from what said from @StoneVo, there isn't nothing else that can be said. – kiamlaluno Apr 3 at 18:43

closed as too localized by kiamlaluno Apr 3 at 18:44

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.