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 4083252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:17:22+00:00 2026-05-20T18:17:22+00:00

I am trying to get this code to show only fields that have values,

  • 0

I am trying to get this code to show only fields that have values, any fields that don’t have values are not meant to be displayed. It doesnt seem to be working

Any idea what I am doing wrong?

My simple test form is here http://www.healthybrighton.co.uk/wse/node/1844

/**
 * Build a table of submitted values
 *
 * @param $form_vals array Submitted form data
 * @param $select_mapping array Map select components to their value|label chocies
 * @return HTML of the themed table
 */       
function _format_form_state($form_vals = array(), $select_mapping) {
  $output = '';  
  $header = array();
  $rows = array();    

  if (!empty($form_vals)) {

    foreach ($form_vals as $component_name => $component_value) {
      $rows = array_merge(
        $rows,
        _add_component_row(
          $component_name,
          $component_value,
          0,
          $select_mapping
        )
      );
    }
  }



  $output .= theme('table', $header, $rows);
  return $output;
}
  • 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-05-20T18:17:23+00:00Added an answer on May 20, 2026 at 6:17 pm
    /**
     * Build a table of submitted values
     *
     * @param $select_mapping array Map select components to their value|label chocies
     * @param $values array Submitted form data
     * @return HTML of the themed table
     */
    function _format_form_state($select_mapping, $values = array()) {
      $header = array(t('First'), t('Second'), t('Third'), t('Fourth'));
      $rows = array();
    
      foreach ($values as $cname => $cval) {
        $rows[] = array($cname, $cval, 0, $select_mapping);
      }
    
      return theme_table($header, $rows);
    }
    

    $select_mapping should be first argument in function.
    Argument with default value should not be preceded by argument without a default value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this piece of code I'm trying to get to display but no
I'm trying to get the exact equivalent (not functional) of this vb.net code in
I've been trying to get this code to work for hours! All I need
hI, I'm trying to get this code from Larry Nyhoff's book to compile in
I'm trying to get this piece of code working a little better. I suspect
Im trying to get pretty.js to prettify code in CODE tags, using this js:
I have been trying to get around this error for a day now and
I have been trying to get this one section of my UI to immediatly
I'm trying to make a simple php shopping cart. I don't have any idea
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get

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.