[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Drupal 6: Unable to retrieve field's value in view

Posted on 2011-09-21
Medium Priority
Last Modified: 2012-05-12
I'm new to Drupal and I just inherited from a developer a content profile form with several fields (used as registration form). I added a few fields but I can't retrieve their values in a views, while the older ones show up correctly. The following for example prints nothing:

<?php print $fields['field_membership_type'] ?>

Open in new window

In the views, I even set the above filed to be set to "xxxx" if empty, but still nothing gets through.

There are no typos and permissions look right (identical to the old fields), so I'm out of ideas...

Question by:jiiins2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 10

Expert Comment

ID: 36572458
First of all make sure you are editing the correct file and that the output isn't being cached.
Edit the file to put '#' or something identifiable outside the <?php ?> tags.  Clear your cache and check you can see your change. If you can't see your change, then you're probably editing the wrong file. (where is the file you are editing and what is it called?)
That may solve your problem (by clearing the cache).
Next, you will need to edit the view to add the extra fields you want.

Author Comment

ID: 36572554
Unfortunately i already tried all of the above. I get only my two ## as print out...
LVL 10

Accepted Solution

oliverpolden earned 2000 total points
ID: 36572576
Are you able to give me a log in to have a look?  You may also want to do print_r($fields); or dpm($fields); if you have the devel module installed.

You probably need to do something like: $fields[0]['field_membership_type'];
Note the [0]
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 36572636
I did the print_r and it shows the new fields as empty. The old fields are printing out just fine without the [0]. How can I pass you the login safely?
LVL 10

Expert Comment

ID: 36572641

Author Comment

ID: 36572665
on its way

Author Comment

ID: 36577581
Got it:

<?php print $fields['field_membership_type_value']->content ; ?>

Open in new window


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
There is a massive demand for content on the web right now, and it doesn't look like it's going to stop any time soon. But, if you are running a business blog, it's not just enough to offer your audience lots of content. It needs to be high-quality…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question